Unity VideoPlayer 全屏到 FGUI

需求:

利用VideoPlayer将视频全屏显示到FGUI上。


解决方案:

在FGUI上创建一个全屏UI,创建一个装载器,大小设置为全屏。

设置 VideoPlayer 的渲染方式为 RenderMode.RenderTexture.

创建RenderTexture,(将视频加载到 RenderTexture 上)

动态创建 RenderTexture

复制代码
 public void CreateVideoRender()
    {
        VideoRenderTexture = RenderTexture.GetTemporary(1920,1080,32, RenderTextureFormat.ARGB32, RenderTextureReadWrite.sRGB);    
    }

然后将 videoPlayer 的 targetTexture 赋值

复制代码
      videoPlayer.targetTexture = ClientCameraManager.Inst.VideoRenderTexture;

最后设置 fugui的装载器的url为 创建的 VideoRenderTexture就好了。

self.fullScreen.texture = xxx.VideoRenderTexture

相关推荐
老朱佩琪!7 小时前
Unity备忘录模式
java·unity·备忘录模式
一帘多啦A梦7 小时前
解决unity2022.3.x版本项目使用vs无法生成解决方案的问题
unity·vs
weixin_4242946710 小时前
Unity LocalPosition 和 Position 的区别?还有其他的Position 没?
unity·游戏引擎
UX201710 小时前
Git LFS 管理 Unity 大文件
git·unity
nnsix10 小时前
Unity WebGL端调用Windows窗口选择文件
unity·游戏引擎·webgl
向宇it10 小时前
【unity游戏开发——网络】使用Unity+PurrNet+Heathens+Steam,在 Unity 中通过 Steam与你的朋友建立联系
网络·游戏·unity·c#·游戏引擎·steam
nnsix11 小时前
Unity 反编译dll(Windows平台)
unity
XR技术研习社11 小时前
四种安装特定版本Package的方法
unity·ar·xr·vr
dzj202112 小时前
Unity行为脚本与编辑器脚本的解耦例子之一
unity·解耦·编辑器脚本·行为脚本
小蜗 strong14 小时前
Unity中MRTK下载相关功能配置(适用HoloLens 2 部署)
unity·游戏引擎·hololens