我正在使用Unity3D进行我的Android游戏。我想将视频添加为动画启动画面。我尝试过不同的方法。我在C#中的代码如下所示:
public class Splash : MonoBehaviour
{
void Start ()
{
StartCoroutine ("PlayMovie");
}
public IEnumerator PlayMovie ()
{
Handheld.PlayFullScreenMovie ("splash.mp4", Color.black, FullScreenMovieControlMode.Hidden, FullScreenMovieScalingMode.AspectFit);
yield return new WaitForSeconds (1);
Application.LoadLevel ("home");
}
}
答案 0 :(得分:1)
你应该像这样使用它
public bool started = false;
void Update ()
{
if (started == false) {
started = true;
StartCoroutine (playMovie ());
}
}
public IEnumerator PlayMovie ()
{
yield Handheld.PlayFullScreenMovie ("splash.mp4",
Color.black,FullScreenMovieControlMode.Hidden,
FullScreenMovieScalingMode.AspectFit);
Application.LoadLevel ("home");
}
您还应该检查文档
https://docs.unity3d.com/ScriptReference/Handheld.PlayFullScreenMovie.html