- 1 using UnityEngine;
- 2 using System.Collections;
- 3
- 4 public class TestUseless : MonoBehaviour
- 5 {
- 6 //电影纹理
- 7 public MovieTexture movTexture;
- 8
- 9 void Start()
- 10 {
- 11 //设置电影纹理播放模式为循环
- 12movTexture.loop =true;
- 13 }
- 14
- 15 void OnGUI()
- 16 {
- 17 // 基于GUI播放视频
- 18GUI.DrawTexture(newRect(0,0, Screen.width, Screen.height), movTexture, ScaleMode.StretchToFill);
- 19
- 20 if(GUILayout.Button("播放/继续"))
- 21 {
- 22 //播放/继续播放视频
- 23 if(!movTexture.isPlaying)
- 24 {
- 25 movTexture.Play();
- 26 }
- 27 }
- 28
- 29 if(GUILayout.Button("暂停播放"))
- 30 {
- 31 //暂停播放
- 32 movTexture.Pause();
- 33 }
- 34
- 35 if(GUILayout.Button("停止播放"))
- 36 {
- 37 //停止播放
- 38 movTexture.Stop();
- 39 }
- 40 }
- 41}
来源: http://www.bubuko.com/infodetail-1992714.html