找回密码
 立即注册
查看: 5775|回复: 85

[基础] Unity3D载入外部视频脚本

[复制链接]
发表于 2013-2-26 15:11 | 显示全部楼层 |阅读模式
资源信息 Tutorial Information
教程名称: Unity3D载入外部视频脚本(发帖教程)
适用引擎:   (适用引擎,为空默认为Unity)
教程语种: 中文
教程等级: 1
教程格式: 文档(请用IE9以上浏览器访问本版块)
教程作者: 转载自互联网 (如有问题请短消息联系作者或发表回复)
下载地址: (兑换积分)
点击查看原图
美丽分割线
Unity3D脚本:Unity3D载入外部视频脚本
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;
// 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)


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
发表于 2017-2-12 16:52 | 显示全部楼层
很不错
发表于 2017-2-12 16:57 | 显示全部楼层
好帖就是要顶
发表于 2017-2-12 16:58 | 显示全部楼层
顶顶多好
发表于 2017-2-12 17:45 | 显示全部楼层
说的非常好
发表于 2017-2-12 17:10 | 显示全部楼层
很好哦
发表于 2017-4-14 14:46 | 显示全部楼层
好帖就是要顶
发表于 2017-4-14 14:45 | 显示全部楼层
顶顶多好
发表于 2017-4-14 14:43 | 显示全部楼层
真心顶
发表于 2017-4-14 14:21 | 显示全部楼层
难得一见的好帖
懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Unity开发者联盟 ( 粤ICP备20003399号 )

GMT+8, 2024-5-2 13:59 , Processed in 0.112714 second(s), 32 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表