MovieTexture 已弃用。请参阅新的电影播放解决方案 VideoPlayer。
如果正在从网站下载电影,则会返回是否已下载足够数据能够开始无间断播放。 对于不与 Web 流关联的电影,此值将始终返回 true。
using UnityEngine; using UnityEngine.Networking;
public class Example : MonoBehaviour { // Plays a movie over a texture from a stream
UnityWebRequest wwwData; string url = ""; GUITexture gt;
void Start() { wwwData = UnityWebRequestMultimedia.GetMovieTexture(url); gt = GetComponent<GUITexture>(); gt.texture = DownloadHandlerMovieTexture.GetContent(wwwData); }
void Update() { MovieTexture m = gt.texture as MovieTexture;
if (!m.isPlaying && m.isReadyToPlay) { m.Play(); } } }