在unity中怎么导入视频文件?

如题所述

unity支持的视频格式包括.mov .mpg .mpeg .mp4 .avi 和.asf
将视频文件拖拽到project视图中,系统会自动生成电影纹理资源。
添加脚本如下:
#pragma strict
var movTexture:MovieTexture;

function Start ()
{
movTexture.loop = true;
}

function OnGUI()
{
GUI.DrawTexture(new Rect (0,0,Screen.width,Screen.height),movTexture,ScaleMode.StretchToFill);
if(GUILayout.Button("播放/继续"))
{
if (!movTexture.isPlaying)
{
movTexture.Play();
}
}
if(GUILayout.Button("暂停播放"))
{
movTexture.Pause();
}
if(GUILayout.Button("停止播放"))
{
movTexture.Stop();
}
}
将这个脚本绑定在照相机上就可以了
温馨提示:答案为网友推荐,仅供参考
第1个回答  2013-06-08
unity好像只支持ogg格式的视屏文件,把视屏转成.ogg的文件然后拖到Assets文件夹下就行了
第2个回答  2013-06-05
放在project工程文件夹里
相似回答
大家正在搜