Unity中UGUI播放视频

    xiaoxiao2021-12-15  55

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

    MovieTexture movieTexture = Resources.Load("***") as MovieTexture; GetComponent<RawImage>().texture = movieTexture; ((MovieTexture)GetComponent<RawImage>().texture).Play(); GetComponent<AudioSource>().clip = ((MovieTexture)GetComponent<RawImage>().texture).audioClip; GetComponent<AudioSource>().Play();
    转载请注明原文地址: https://ju.6miu.com/read-1000069.html

    最新回复(0)