I have child object with ParticleSystem component. I want to have particles disabled until I press button.
I unchecked child object to make it disabled but when I press play it enables automatically(with no scripts attached). Then I made this script below (with .SetActive(false) part only) and it worked.
But then I needed to activate it somehow, which I did, but now when I press play, object is automatically enabled/ activated again.
Is there another way of doing this because I need it haha.
var particle1: GameObject;
var particle2: GameObject;
var particle3: GameObject;
public var triggered : boolean = false;
function OnTriggerEnter() { triggered= true; }
function OnTriggerExit() { triggered= false;}
function Start()
{
particle1.SetActive(false);
particle2.SetActive(false);
particle3.SetActive(false);
}
function Update()
{
if (triggered && Input.GetKeyDown(KeyCode.JoystickButton1))
particle1.SetActive(true);
particle2.SetActive(true);
particle3.SetActive(true);
}