返回介绍

MovieTexture.Play 播放

发布于 2019-12-18 15:38:04 字数 1936 浏览 1170 评论 0 收藏 0

JavaScript => public function Play(): void;
C# => public void Play();

Description 描述

Starts playing the movie.

开始播放影片。

Note that a running MovieTexture will use a lot of CPU power, and it will continue running until it is manually stopped or a new level is loaded.

注意运行MovieTexture将使用大量的CPU资源,并且它将持续运行直到它被手动停止或加载新的关卡。

Also note that MovieTextures does not behave exactly the same as for example audio clips. When you call the Play() method on a MovieTexture, it is the Asset that will start playing, and not a particular instance of the movie. This means that if you have for example several planes in your scene, all having the same MovieTexture set as their materials texture, when you call Play() on one of them, every instance of the Movie will start playing.

并注意,MovieTextures是不完全相同的行为,例如音频剪辑。当在一个MovieTextures上调用Play()方法,资源将被播放,而不是电影的特定实例。这意味着如果在你的场景中实例几个飞机,所有相同MovieTexture设置为他们的材质纹理,当你在他们中的一个上调用Play(),影片的每一个实例将开始播放。

See Also: Stop, audioClip.

JavaScript:

// Assigns a movie texture to the current material and plays it.
 
var movTexture : MovieTexture;
 
function Start () {
	GetComponent.<Renderer>().material.mainTexture = movTexture;
	movTexture.Play();
}

C#:

using UnityEngine;
using System.Collections;
 
public class ExampleClass : MonoBehaviour {
    public MovieTexture movTexture;
    void Start() {
        GetComponent<Renderer>().material.mainTexture = movTexture;
        movTexture.Play();
    }
}

MovieTexture

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文