Outputting video playback to a RenderTexture asset
Directly working with the VideoPlayer texture works for the previous recipe, but usually, setting up a separate RenderTexture asset is more reliable and flexible. This recipe will build on the previous one to demonstrate this approach.
A flexible way to work with video players is to output their playback to a RenderTexture asset file. A material can be created to get input from RenderTexture and, using that material, GameObjects will display the video. Also, some GameObjects can directly have RenderTexture assigned to their texture.
Getting ready
This recipe follows on from the previous one, so make a copy of that and work on the copy.
How to do it...
To output video playback to a RenderTexture asset, do the following:
- In the Project panel, create a new
Render Textureasset file namedmyRenderTextureby going to Create | Render Texture. - Select the UI RawImage in the Hierarchy panel, and assign...