Uinity学习的一些知识点
2015-03-17 23:20
162 查看
Uinity怎么播放视频
要想播放一个后缀名为.mov的视频文件,首先需要先安装一个软件(quickTime),安装quickTime软件的时候,需要以管理员的身份进行安装,要不然会存在问题。
这个视频需要绑定到Main Camera上,并且为其加上脚本,如果想要播放声音,在选中Main Camera后,在Inspector中添加Auto Source,并把play On Awake给打上对勾。
取消视频播放(即是跳过视频)
要想播放一个后缀名为.mov的视频文件,首先需要先安装一个软件(quickTime),安装quickTime软件的时候,需要以管理员的身份进行安装,要不然会存在问题。
这个视频需要绑定到Main Camera上,并且为其加上脚本,如果想要播放声音,在选中Main Camera后,在Inspector中添加Auto Source,并把play On Awake给打上对勾。
public MovieTexture movTexture; // Use this for initialization void Start () { movTexture.loop = false; movTexture.Play(); } // Update is called once per frame void Update () { } void OnGUI(){ GUI.DrawTexture(new Rect(0,0,Screen.width,Screen.height),movTexture); }
取消视频播放(即是跳过视频)
void Update () { //人工干预停止 if(isDrawMov){ if(Input.GetMouseButtonDown(0) && isShowMessage == false){ isShowMessage = true; }else if(Input.GetMouseButtonDown(0) && isShowMessage == true){ StopMov(); } } //正常播放最后一帧停止 if(isDrawMov != movTexture.isPlaying){ StopMov(); } } void OnGUI(){ if(isDrawMov){ GUI.DrawTexture(new Rect(0,0,Screen.width,Screen.height),movTexture); if(isShowMessage){ GUI.Label(new Rect(Screen.width/2,Screen.height/2,100,10),"退出动画"); } } } private void StopMov(){ movTexture.Stop(); isDrawMov = false; }
相关文章推荐
- 学习字符串时的一些知识点(来源书上,仅供个人学习使用)
- 学习封装的一些知识点(来源书上,仅供个人学习使用)
- 最近学习安卓中总结的一些知识点 复制代码
- 记录一些学习到的零碎的知识点。
- 【C++再学习】【05】有关类的一些知识点整理
- Jdk1.5的新语法和一些java学习的小知识点
- Cocos2dx 学习记录 [2] 关于混合和高亮一些知识点的体会
- 七月份学习的一些零散知识点
- [cocos2d-x]学习demo一些未理解的知识点
- Cocos2dx 学习记录 [2] 关于混合和高亮一些知识点的体会
- 学习继承和多态的一些知识点
- 一些知识点的初步理解_1(集成学习,ing...)
- Java 入门后需要学习的一些知识点
- IOS学习笔记48--一些常见的IOS知识点+面试题
- (1).DSP学习之前的一些知识点
- 学习数组时的一些知识点(来源书上,仅供个人学习使用)
- GMF学习系列(二) 一些知识点(续2)
- [置顶] Android 学习笔记一些小知识点(2014.08.25更新)
- Java学习心得——一些容易被忽略但很重要的知识点
- selenium2.0&WebDriver学习系列(一些需要注意的知识点)