Make A Treasure Chest System Using Timeline

Suleiman Abdullah
3 min readJan 15, 2023

Objective: Make A Treasure Chest System Using Timeline.

In the first step, I will create a timeline and then record the treasure chest opened.

Now I will create an activation track to make particle play when the treasure chest is opened. Make sure to disable particle system after play with its setting.

Create a new script called chest trigger and attach it to the treasure chest geometry or 3D object.

Now Add a box collider to the chest and set is a trigger to true.

Select timeline, go to the inspector, and disable play on Awake. Then set Wrap mode to hold.

Now open that script, and create a playable Director variable, to access this you need to use a namespace called “using UnityEngine.Playables”.

Now to make sure when the player reaches this treasure our timeline play, we do this using OnTriggerEnter and check if another tag is the player. Then we play the director, to play director we used the director variable dot play.

Last, select the chest object which has a script, and drag the timeline in the inspector.

Let's see the result, to make the particle not last until the end of the timeline you can adjust the activation track to not equal with animation.

See you in the next article.

--

--

Suleiman Abdullah

Self taught Unity Developer, who is passion about making games ,and he loves Math For Game Development