Skippable cutscene

If i wanted to implement a option to skip the cutscene when its playing, say by pressing spacebar how would i go about implementing that?

im sure its something like putting an if statement in the cinematicontrolremover script, if(Input.GetKeyDown(KeyCode.Space) … but not sure where to put it

or would i go with a while statement in the trigger script
while (GetComponent().Play())

1 Like

I would put this in the CinematicControlRemover.cs script.
First, you’ll need a bool

private bool isPlaying;

In DisableControl(), add

isPlaying=true;

and in EnableControl(), add

isPlaying=false;

Finally, you’ll need an Update() method to listen for the space bar

        private void Update()
        {
            if (!isPlaying) return;
            if (Input.GetKeyDown(KeyCode.Space))
            {
                GetComponent<PlayableDirector>().Stop();
                isPlaying = false;
            }
        }
3 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms