Video on a Canvas
Video Actions
Action Name | Description |
Add Video to Canvas Panel | Adds a Local or Remote Video to the Canvas |
Play Video on Canvas | Starts the Video Playing with parameters |
Pause Video on Canvas | Pauses the Video |
Stop Video on Canvas | Stops the Video from Playing |
Resume Video on Canvas | Resume playing the Video |
Remove Video from Canvas Panel | Removes the Video from the Canvas Panel |
The suggested process for adding and playing a Video on a UI Canvas is as follows:
Using Unity's dropdown menu, add a RawImage element to your Canvas Panel and size it to whatever size you wish your video to be when playing.
You can add a background texture to the RawImage if you wish (see UI example), but the color seeting in the RawImage must be white to be able to see the video correctly.
Within a Trigger of your choice, include the Action Add Video to Canvas.
Set the Origin (Local would be a Video in your resources folder, remote would be a video on a server) to your chosen Video, and the name/path of the video.
The Unity Video Player does not yet work with YouTube Videos and the URL for a remote video must be a full url address (ie: include the http)
5. Add the RawImage from your scene hierarchy to this Action under Target Raw Image. The Target RawImage must also be added to all Actions that control this Video (Play, Pause, Stop, Remove) as you can have multiple videos in your scene.
6. You can add the Play Video Action to this Action after the Add Video, or you can add it to another Action if required. However, it is important that the Video is added to the RawImage before you attempt tp play it.
7. These Actions will Automatically create a Render Texture, add it to the RawImage, and create and execute the Video Player.
Last updated