I need to play a particle system 10 secs after the game started, I create a public ParticleSystem variable and drop the ParticleSystem on the editor , then with a InvokeRepeating I call a function that have this line : particleSystem.Play();
but it give me the following error : Object reference not set to an instance of an object UnityEngine.ParticleSystem.Play (Boolean withChildren).
Someone knows the error ?? or knows how to do that ?
thanks !!
public class Fireworks : MonoBehaviour {
public ParticleSystem particleSystem = new ParticleSystem();
void Start()
{
InvokeRepeating("fireworks", 1.0F, 1.0F);
}
public void fireworks(){
particleSystem.Play();
}
}