Using Timeline to Create Explosions
Objective: Create dynamic Explosion Sequences Using Timeline!
We are going to start this off by downloading an explosion off of Filebase.
Drop the explosion prefab onto the scene.
Right now, this is set to play on awake. I’m going to create a multi explosion on a ship as it gets destroyed. I’ve created a super simple script that is going to have the ship move slowly through the scene.
We are going to be moving the director so we cannot simply put the director on the parent object because it is going to override the world position. (Director_Explosion_Position) We need to create another empty game object “Director_Explosion” and child the explosion prefab under the position object.
Make sure these objects are set to zero which is the director position. Also make sure your explosion is not too large for the effect you are going for.
Now we are ready to add the director Timeline. This goes on the Director_Explosion.
Now we are going to drag the explosion onto the Timeline and this is going to create a control track. That is because it is a particle system, which is fine it will work similar to an activation track.
Duplicate the explosion and let's repeat this process 3–4 more times.
We can tie the director_Explosion_Position to the ship object. Remember to reset the Transform component.
Once the explosions have finished, we can add the spaceship to the Timeline and as an activation track and have it end before the last explosion is finished.
We need to rearrange our scene to make this effect work. At the top we need to have our empty game object with the movement script attached. Next, the director, then the explosion, and then the ship. This way when we turn off out spaceship geometry it doesn’t actually effect the position of the spaceship.
Now re apply the ship to the Timeline in an activation track and end right after the final explosion.
You can take this timeline and control it with code or triggers for when the player’s health reaches zero or any other reason you can think of. Now you know how to make dynamic animations utilizing Timeline.