Get That Card!- Game Dev Series 73

Objective: trigger a cutscene during game scene.

We have been through so many obstacles all the way till the sleeping guard. Now we will steal the card and toward the final victory, which will trigger the cutscene we have made before.

In this article, we will set the cutscene trigger to play the cutscene and back to game scene after it finished.

Set the trigger

In the Hierarchy, you should see the collider around the security table. Select it and create a new script to it.

In the script, we will add a trigger detect function to detect our Player. And also activate the cutscene.
Create a gameobject variable, and activate it in the OnTriggerEnter().

Attach the script into that collider and drag the cutscene into script.

Play the game and it should start the cutscene when Player touched the collider.

Disable the sleeping guard in scene

You may notice that the sleeping guard in scene is not disappear after the cutscene started.

We can disable the in game gameobject to solve this problem.

Open sleeping guard timeline and add an activation track, then drag in the sleeping guard gameobject.

Adjust the active track to the end and make the rest of track is disable.

This should make the sleeping guard would appear when the cutscene is end.

Disable cutscene & back to scene

After the cutscene, we should go back to the game. To do this, we can simply create another activate track to disable the current cutscene.

However, you can not drag in the Sleeping Guard Cutscene which would cause some error.
Instead, you can drag in the parent gameobject “Cutscene” to disable it.

Drag it in and disable in the end frame of cutscene.
After this, we also need to adjust the camera or it should stuck on the last camera of cutscene.

Right click on the Cinemachine track of Timeline and add a Cinemachine shot.

It should create a clip after the existing clips. Adjust the duration to make just remain for 1 frame.

Now back to Hierarchy and add a new Virtual Camera and reset the position to where the camera should be before the cutscene started. And drag it into the virtual cameras container.

In Timeline, click the newest clip and select the virtual camera we have just added in Hierarchy.

All done! Now your game should back to the state before cutscene.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
S.J. Jason Liu

S.J. Jason Liu

99 Followers

A passionate gamer whose goal is to work in video game development.