Babybus-u3d技术交流-Unity 3D如何在GameObject上播放视频
很久之前的笔记了……呵呵,凡是和当前项目无关的笔记都可以分享,好多文档都是入门级的……
关于在GameObject上播放视频,实在是记不得视频格式了……如果有需要可以到官网上找到的。using
UnityEngine;
usingSystem.Collections;
public class PlayIntroductionVideo:MonoBehaviour
{ public MovieTexture movie;
float videoWidth;
float videoHeight;
float top;
// Use this for initialization
void Start()
{
videoWidth=Screen.width;
videoHeight= videoWidth/1.7f;
top=(Screen.height- videoHeight)/2;
GUI.DrawTexture(new Rect(0, top, videoWidth, videoHeight),movie);
movie.Play();
}
void OnGUI()
{
if(Input.GetButtonDown("Jump")||!movie.isPlaying)
{ Application.LoadLevel(1);
DontDestroyOnLoad(gameObject);
}
}
}
using UnityEngine;
using System.Collections;
public class TestScript:MonoBehaviour
{
public MovieTexture movTexture;
void Start()
{
renderer.material.mainTexture= movTexture;
movTexture.Play();
}
}