Textures & Rendering
ProperVideoPlayer writes decoded frames to a RenderTexture exposed through
CurrentTexture. Display it with Output Image or bind it to a material.
Use the managed texture#
Leave Target Texture unassigned when the application does not require a specific RenderTexture. The component owns the texture, configures its storage for the active backend, assigns it to Output Image, and releases it when the player is destroyed.
Read the decoded dimensions from VideoWidth and VideoHeight. On the classic WebGL path,
the JavaScript backend reallocates the underlying graphics texture to the media dimensions; the Unity
RenderTexture descriptor does not necessarily reflect that native storage size.
Supply a RenderTexture#
Assign Target Texture when another system must own the texture. Sizing behavior depends on the active backend:
| Backend | Behavior |
|---|---|
| Classic WebGL | The JavaScript backend reallocates the underlying WebGL texture storage to the video's native dimensions. Treat the Unity object as a handle and use VideoWidth/VideoHeight for decoded dimensions. |
| Unity WebGPU | The supplied RenderTexture is not resized. A frame larger than the texture is cropped to its bounds. See Unity 6 WebGPU. |
| Editor and non-WebGL platforms | Unity's VideoPlayer renders at the supplied texture's dimensions and applies the component's Aspect Ratio setting. |
Assign a different RenderTexture to each player. The component reports an error if it detects that two players share the same texture.
Vertical orientation#
The WebGL backend requires a vertical UV flip. When Output Image is assigned, the component
applies the correct RawImage.uvRect automatically. No additional shader logic is required for that
path.
For a custom material, apply the flip when RequiresVerticalFlip is true:
var material = renderer.material; // Creates a material instance for this renderer
var flip = player.RequiresVerticalFlip;
material.mainTexture = player.CurrentTexture;
material.mainTextureScale = new Vector2(1f, flip ? -1f : 1f);
material.mainTextureOffset = new Vector2(0f, flip ? 1f : 0f);
This example requires a shader that applies the standard main-texture scale and offset. In a custom shader that
does not use _MainTex_ST, invert the V texture coordinate in the shader instead.
Bind custom materials after OnOpened. Some backends replace an auto-managed RenderTexture when a
source is opened. If the source dimensions later change, handle OnResized and rebind when the
CurrentTexture reference has changed.
Render pipelines#
The runtime output is a standard texture and is not tied to a particular render pipeline. Materials must use a shader compatible with the project's active pipeline and must apply the orientation rule above.