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

相关推荐
谢斯2 小时前
[unity]如何在unity中添加newtonsoft-json
unity·json·游戏引擎
天人合一peng3 小时前
Unity标记固定颜色及投影标记
unity
云雨巫山6 小时前
Unity 游戏开发性能优化全景手册
unity·智能手机·性能优化·游戏引擎
maybeyaluokenai6 小时前
unity build in渲染管线概述
unity·图形渲染
云雨巫山7 小时前
Unity 性能优化 · 图解全景手册
unity·性能优化·游戏引擎
Madokaly1 天前
DOTween的Vector3Plugin
unity
一梭键盘任平生1 天前
Shader入门笔记2
unity
点心的游戏开发世界2 天前
Unity C# 脚本学习笔记:命名空间与 using
学习·unity·c#
点心的游戏开发世界2 天前
Unity C# 脚本学习笔记:泛型
学习·unity·c#
微三云生态系统架构师-彭丹3 天前
任务卷轴积分系统架构设计:从任务状态机到合规风控的完整实现
unity·系统架构·游戏引擎