I’m trying to get a simple particle flamethrower to work in Unity with a particle system and mouse click. I think the else statement is causing an issue. Nothing happens when I press the left trigger or take my finger off like I assume the code should.
On press (hold) start particle, then whenever I’m not, stop it?
#pragma strict
var flameThrower : ParticleSystem;
function Start ()
{
flameThrower.Stop();
GameObject.Find("FlameCollider").GetComponent(Collider).enabled = false;
}
function Update ()
{
if (Input.GetMouseButton(0))
{
flameThrower.Play();
GameObject.Find("FlameCollider").GetComponent(Collider).enabled = true;
Debug.Log("Play");
}
else
{
flameThrower.Stop();
GameObject.Find("FlameCollider").GetComponent(Collider).enabled = false;
Debug.Log("Stop");
}
}