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

相关推荐
Aman19843 小时前
Claude Code做Unity项目移植(二): 自动执行只读操作,告别频繁的
unity·游戏开发·vibe coding·claude code
暴走约伯12 小时前
【VFX工具链源码拆解 02】告别机械劳动(上):一键统改百个子粒子颜色与批量重命名
3d·unity·c#·材质
郝学胜-神的一滴13 小时前
游戏设计:原型与开发 18:Unity入门的第一课
人工智能·程序人生·游戏·ui·unity·游戏引擎
淡海水15 小时前
09-01-内存-Unity资源生命周期全景
unity·c#·游戏引擎·.netcore·gc
LF男男19 小时前
Flower Defense—UIFacade
unity
呆呆敲代码的小Y19 小时前
【实战精选面试题】Unity精选面试题详细解答,按模块整理汇总
人工智能·游戏·unity·游戏引擎
小贺儿开发1 天前
《流光绘忆》Unity 沉浸式光影互动
科技·unity·ai·程序员·工具·互动·光影
Aman19841 天前
Claude Code做Unity项目移植(一):从零散工具到团队式
unity·游戏开发·vibe coding·claude code·项目迁移
地狱为王1 天前
Unity使用VoxLock实现语音隔离
unity·游戏引擎·音频处理·voxlock
Jmyd01232 天前
博物馆数字展厅系统架构设计:实景采集到云渲染全链路
unity·系统架构·博物馆·数字展厅·博物馆数字化