IEnumerator FreezeRoutine() { if (conditionalParticleSystem == null || freezeParticleSystem == null) { yield break; } // Wait while the conditional particle system isn't ready to begin or while it's still alive while (!conditionalParticleSystem.IsReady() || conditionalParticleSystem.IsAlive()) { yield return(null); } // Wait extra time if specified if (extraWaitingTime > 0) { yield return(new WaitForSeconds(extraWaitingTime)); } // Freeze the particle system by setting time scale to 0 now when the conditional particle system isn't alive any longer freezeParticleSystem.particleTimescale = 0; }