How i turn off the Emitter after few seconds?
Here's a simple script you can put on the object with the particle emitter:
function Start(){
Invoke("StopEmitter", 3); //In 3 seconds, runs StopEmitter function
}
function StopEmitter(){
gameObject.GetComponent(ParticleEmitter).emit= false; //tell the emitter to stop.
}
I used coroutine to achieve the wait behavior. But i don’t is there any performance issue or its a bad approach for this secenario.
private ParticleSystem ps;
private void method1(){
StartCoroutine(nextLevelLoadTime());
}
IEnumerator startAndStopParticleSystem()
{
ps = GetComponentInChildren<ParticleSystem>();
ps.Play();
yield return new WaitForSeconds(3);
ps = GetComponentInChildren<ParticleSystem>();
ps.Stop();
yield return new WaitForSeconds(1);
callOtherFunction
}