Removed

WWW.movie

切换到手册
Obsolete public Object movie ;

描述

返回从下载的数据生成的 MovieTexture(只读)。

数据必须为 Ogg Theora 格式的电影。

即使电影尚未下载完成,也会立即返回, 以便您能够在下载的同时开始播放已下载的电影部分。

另请参阅:MovieTexture.audioClip

using UnityEngine;
using System.Collections;

// Make sure we have gui texture and audio source [RequireComponent(typeof(GUITexture))] [RequireComponent(typeof(AudioSource))] public class ExampleClass : MonoBehaviour { string url = "http://www.unity3d.com/Movie/sample.ogg";

IEnumerator Start() { // Start download using (var www = new WWW(url)) { yield return www;

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

var gt = GetComponent<GUITexture>();

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

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

// 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(); } } }