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

相关推荐
nnsix10 小时前
Unity PicoVR开发 实时预览Unity场景 在Pico设备中(串流)
unity·游戏引擎
一只一只15 小时前
Unity之UGUI Button按钮组件详细使用教程
unity·游戏引擎·ugui·button·ugui button
WarPigs19 小时前
Unity阴影
unity·游戏引擎
一只一只19 小时前
Unity之Invoke
unity·游戏引擎·invoke
tealcwu1 天前
【Unity踩坑】Simulate Touch Input From Mouse or Pen 导致检测不到鼠标点击和滚轮
unity·计算机外设·游戏引擎
ThreePointsHeat1 天前
Unity WebGL打包后启动方法,部署本地服务器
unity·游戏引擎·webgl
迪普阳光开朗很健康1 天前
UnityScrcpy 可以让你在unity面板里玩手机的插件
unity·游戏引擎
陈言必行2 天前
Unity 之 设备性能分级与游戏画质设置与设备自动适配指南
游戏·unity·游戏引擎
CreasyChan2 天前
Unity DOTS技术栈详解
unity·c#·游戏引擎
在路上看风景2 天前
1.1 Unity资源生命周期管理与内存机制
unity