-3

I am creating an interactive video using Unity/C#. I am doing this using scenes and buttons that when clicked, go to the next scene or back. However, I want the buttons to appear once the video is finished. Is there any way I can add a delay to the buttons before they appear in the scene when playing?

derHugo
  • 83,094
  • 9
  • 75
  • 115

2 Answers2

0

This should do the trick. isPlaying.

A simple script would look like this.

if(videoplayer.isPlaying == false && videoWasPlayed == true){
  btn.active = true;
  videoWasPlayed = false;
}

videoWasPlayed is used to check if the video was ever played. This would need to be set to true when the video is played.

PotSkill
  • 221
  • 3
  • 11
0

For time delay you could use coroutines. Check it out here There is options like waitforseconds so you can delay your button apperance. here is sample code

private IEnumerator ShowBtn()
{
    yield return new WaitWhile(() => videoplayer.isPlaying);
    // show visibility of your button
}

And when you play video call this function like this

StartCoroutine(ShowBtn());
Jaimin
  • 501
  • 4
  • 13