Unity中UGUI播放视频

在UGUI的Canvas中添加RawImage,在代码中定义MovieTexture,将MovieTexture的值赋值给RawImage的Texture。

MovieTexture movieTexture = Resources.Load("***") as MovieTexture;
GetComponent().texture = movieTexture;
((MovieTexture)GetComponent().texture).Play();
GetComponent().clip = ((MovieTexture)GetComponent().texture).audioClip;
GetComponent().Play();

你可能感兴趣的:(Unity学习)