Video
Add a VideoPlayer component (Add Component > Rendering) to an object and set clip to an .mp4 (H.264 picture, AAC sound).
- The picture is a texture called
render:<target>(targetempty: the object's name). Withon_objecton (the default) it is the albedo map of the object's own material; any material's albedo map or a UI image can namerender:<target>instead. - Edit mode shows the first picture. Play starts it when
play_on_awakeis on;looping,speedandvolumedo what they say. - The sound is an AudioSource the player adds to the object (an AudioSource you put there yourself is left alone: give it the same clip). An
.mp4is also accepted as an AudioSource clip. - Scripts:
playing(set false to pause, true to play) andtime(seconds; set it to jump) are ordinary component fields. - Decoding is the engine's own (OpenH264, compiled from source: the licence of H.264 for a shipped game is the game's to consider). The editor, desktop players, iPhone player and Android player have the decoder (Android's plays on the emulator:
scripts/mobile/android-emulator-check.sh); the web player uses the browser's own<video>decoder instead (OpenH264 cannot be built for wasm): any format the browser plays, sound included from the element; its volume follows the component, and a browser that blocks sound before a click plays the video muted. Tested in headless Chrome (fixtures/web-video,browser_test.py --video). - Only constant-frame-rate H.264 in MP4/MOV; other codecs (VP9, HEVC, ProRes) are refused with a message. Re-encode with
ffmpeg -i in.mov -c:v libx264 -pix_fmt yuv420p -c:a aac out.mp4.