Outputting video playback to a Render Texture asset

A flexible way to work with Video Players is to output their playback to a Render Texture asset file. A Material can be created to get input from the Render Texture, and GameObjects using that Material will display the video. Also, some GameObjects can directly have the Render Texture assigned as their texture.

Do the following:

  1. In the Project panel, create a new Render Texture asset file named myRenderTexture (menu: Create | Render Texture).
  2. Select the UI Raw Image in the Hierarchy, and assign its Raw Image (Script) texture property to the myRenderTexture asset file.
  3. In the Project panel, create a new Material asset file named m_video. For this Material, in the Inspector, set its Albedo ...

Get Unity 2018 Cookbook - Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.