Create a skip cutscene button in Unity.
Allowing the player to start the game without see the whole cutscenes
Objective: create a UI Button and skip and change the time in the timeline at the end of the cutscene.
First step is to create a UI Button, in this case I placed it in the right button corner.
Then we have to create a new C# script. I called it TimelineController and added it to the Intro Cutscene gameobject.
In the timeline controller script we have to use the namespace UnityEngine.Playables in order to access the functions in the playable director. I created a variable to store the reference of the playable director of the intro cutscene and a function that receive the time mark to set in the timeline. In this case we are gonna pass a value around the end of the cutscene.
After that, we have to select the button and in the inspector we have to add 2 actions in the “OnClick” section. First we have to call the function in the intro cutscene to set the new time and skip the shot. The other action is to disable the skip button to avoid the player pressing it multiple times.
And that’s it!!! We have a functional skip button for our cutscenes.