- 最后登录
- 2019-12-2
- 注册时间
- 2012-8-25
- 阅读权限
- 90
- 积分
- 34660
- 纳金币
- 38268
- 精华
- 111
|
ogg媒体文件放在:
工程: assets/video
exe: data/video- public var url="file:///c:/sample.ogg";
-
- function Start ()
- {
- url="file:///" + Application.dataPath + "/video/sample.ogg";
- print(url);
- // Start download
- var www = new WWW(url);
- // Make sure the movie is ready to start before we start playing
- var movieTexture = www.movie;
- print("downloading...");
- while (!movieTexture.isReadyToPlay)
- {
- print(www.progress);
- yield;
- }
- print("download complete");
- print(www.url);
-
- // Initialize gui texture to be 1:1 resolution centered on screen
- guiTexture.texture = movieTexture;
-
- transform.localScale = Vector3 (0,0,0);
- transform.position = Vector3 (0.5,0.5,0);
- guiTexture.pixelInset.xMin = -movieTexture.width / 2;
- guiTexture.pixelInset.xMax = movieTexture.width / 2;
- guiTexture.pixelInset.yMin = -movieTexture.height / 2;
- guiTexture.pixelInset.yMax = movieTexture.height / 2;
- //unity3d:www.unitymanual.com
- // Assign clip to audio source
- // Sync playback with audio
- audio.clip = movieTexture.audioClip;
-
- // Play both movie & sound
- movieTexture.Play();
- audio.Play();
- }
- // Make sure we have gui texture and audio source
- @script RequireComponent (GUITexture)
- @script RequireComponent (AudioSource)
复制代码 * 版权声明:转载时请以超链接形式标明文章原始出处和作者信息
* 本文来自:Unity3D 教程手册
* 本文链接:http://www.unitymanual.com/6835.html
|
|