- Home /
Using a particle System in an if statement
Hello, I have one script that starts a particle system on an object and another that says if it collides with that object another particle system will start. I am having trouble finding out how to say if particle emitter is emitted then start emitter. Here is my scripts.
function Start () {
particleEmitter = false;
}
function OnMouseOver () {
if (Input.GetButtonUp ("Fire1")){
particleEmitter = true;
}
}
Second script
function Start (){
particleEmitter.emit = false;
}
function OnCollisionEnter ( hit : Collision) {
if(hit.gameObject.tag == "ball"){
***if (firestart.particleEmitter.emit= true)***{
particleEmitter.emit = true;
}
}
}
Where the *s are is where I have trouble So how do I get this to start the particle if the other particle is going. Thank you :)
Answer by robertbu · Feb 19, 2013 at 02:26 AM
I'm not sure what you are trying do here. First, for a comparison you use double equals ('=='). A single equals is used for assignment. But you don't really need the assignment at all. You can just do:
if (firestart.particleEmitter.emit)
But then you are saying if 'emit' is true, then you are assigning true to 'emit'. Do you want 'enabled' instead?