Version: 2017.1
public static MovieTexture GetMovieTexture (WWW www);

Description

Returns a MovieTexture generated from the downloaded data (Read Only).

Даннные изображения должны быть в формате JPG или PNG. Данные в другом формате, не подойдут.

Even if the movie is not yet completely downloaded, this returns immediately, allowing you to start playing the partial movie as it downloads.

See Also: MovieTexture.audioClip.

var url = "http://www.unity3d.com/Movie/sample.ogg";

function Start () { // Start download var www = new WWW(url);

// Make sure the movie is ready to start before we start playing var movieTexture = www.GetMovieTexture(); while (!movieTexture.isReadyToPlay) yield;

var gt = GetComponent.<GUITexture>();

// Initialize gui texture to be 1:1 resolution centered on screen gt.texture = movieTexture;

transform.localScale = Vector3 (0,0,0); transform.position = Vector3 (0.5,0.5,0); gt.pixelInset.xMin = -movieTexture.width / 2; gt.pixelInset.xMax = movieTexture.width / 2; gt.pixelInset.yMin = -movieTexture.height / 2; gt.pixelInset.yMax = movieTexture.height / 2;

// Assign clip to audio source // Sync playback with audio var aud = GetComponent.<AudioSource>(); aud.clip = movieTexture.audioClip;

// Play both movie &amp; sound movieTexture.Play(); aud.Play(); } // Make sure we have gui texture and audio source @script RequireComponent (GUITexture) @script RequireComponent (AudioSource)
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961