Showing the button when the VideoPlayer finishes

I am trying to make a final scene which starts with a short video. I’ve already managed to play the clip with the VideoPlayer GameObject, but the problem is that the button which is there as a part of the Canvas overlaps my video the whole time.

The button should be there to send you back to the main screen (basically to end and restart the game). Is there any way to make the button appear only when the video has finished playing? Or to hide the video when it stops playing? But in this case, how do I set my video to play in front of the button?

You can change the alfa-channel in your Button/Video.

Many Objects have a standard color.
If you write
obj.color = new Color(obj.color.r,obj.color.g,obj.color.b,0f);
You can’t see the Object.
obj.color = new Color(obj.color.r,obj.color.g,obj.color.b,1f);
makes the Object appear.

If the button is an UI-Sprite try this:

void Start()
/*Starting the video(I don't know how to do this)*/
Invoke("ButtonOk" , videolenght);

void ButtonOk()

Button.GetComponent<Image>().color = new Color(0, 0, 0, 1f);
/*Add somthig like Button.getComponent<ButtonScr>().ButtonReady = true; Because else you still can press on the button even if it is invisible*/

Add a CanvasGroup to the Canvas.

I’ll use dummy variables for the canvas group and the video. Change these for your variables.


IENumerator PlayMyVideo()
 While (video.IsPlaying())
   yield return null;

Make sure you save everything before you run this, because if I’ve got the while loop wrong, you’ll be stuck in an unbreakable loop.

I’m doing this from memory on my mobile so apologies if the code is not 100%.