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

相关推荐
垂葛酒肝汤5 小时前
Unity中的协程的原理
unity·游戏引擎
垂葛酒肝汤7 小时前
Unity第一个项目
unity·游戏引擎
Sator17 小时前
Unity的InputSystem常见问题和疑惑解答
java·unity·游戏引擎
郝学胜-神的一滴7 小时前
QtOpenGL多线程渲染方案深度解析
c++·qt·unity·游戏引擎·godot·图形渲染·unreal engine
__water1 天前
RHK《Unity接入PicoSDK入门》
unity·游戏引擎·picosdk
我的golang之路果然有问题1 天前
unity 资源导入 godot
unity·游戏引擎·godot
迪普阳光开朗很健康1 天前
Unity+Vscode+EmmyLua+XLua 调试实战
vscode·unity·游戏引擎
Var_al1 天前
Unity编辑器扩展:标准化UI组件快速创建工具开发指南
ui·unity·c#·编辑器
CreasyChan1 天前
Unity 中的 IEnumerator协程详解
unity·c#·游戏引擎
熬夜敲代码的小N1 天前
基于Unity开发Pico VR眼镜基础应用:从环境搭建到实战部署全解析
人工智能·unity·游戏引擎·vr