Time for action – kill kill murder die
An explosion like this can't be allowed to roam the streets, wreaking its flaming spite on unsuspecting civilians. It must be stopped. And you, being a video game programmer, are the only person who can stop it.
Write a quick script to determine when the last particle in the explosion has run its course, and then destroy the explosion. It's the only way.
Create a new JavaScript called
DestroyParticleSystem
, and attach it as a component to Explosion.Modify the script thusly:
function LateUpdate () { if (!particleSystem.IsAlive()) { Destroy (this.gameObject); } }
The built-in
LateUpdate
function fires after allUpdate
function calls have finished.At the moment, if you click to view the Explosion Prefab in the Project panel, you may notice—to your horror—that all of the recent changes you made to your Explosion Particle System have not "stuck" in the Prefab. To commit all of the Hierarchy panel's Explosion changes to the Prefab mothership, click on...