x


Problems with mesh particle emitter

Hi, I have a mesh particle emitter and I want to make it enabled when pressing space. So, I tried:

var torus : GameObject;

function Start () { torus.particleEmitter.enabled = false; }

function Update () { if(Input.GetButton("Jump")) {torus.particleEmitter.enabled = true;} else { torus.particleEmitter.enabled = false;} }

But it doesn't work. How can I do that?

-H.

more ▼

asked Dec 02 '10 at 11:19 AM

Hektor gravatar image

Hektor
35 9 9 17

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

instead of

torus.particleEmitter.enabled = false;

you should do

torus.particleEmitter.emit = false;

and to turn it on, you would do

torus.particleEmitter.emit = true;

so your whole script according to what's currently posted, would look like:

var torus : GameObject; 

  function Start () 
  {
     torus.particleEmitter.emit = false;
  }

  function Update ()
  {
     if(Input.GetButton("Jump"))
    {torus.particleEmitter.emit = true;}
  else
  {
     torus.particleEmitter.emit = false;}
  }
more ▼

answered Dec 02 '10 at 07:59 PM

Jesus_Freak gravatar image

Jesus_Freak
1.2k 38 44 59

Thank's, now it works fine!

Dec 03 '10 at 10:47 AM Hektor
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2087
x1359
x318
x89
x66

asked: Dec 02 '10 at 11:19 AM

Seen: 1236 times

Last Updated: Dec 02 '10 at 11:27 AM