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

相关推荐
CreasyChan1 天前
C# 反射详解
开发语言·前端·windows·unity·c#·游戏开发
世洋Blog1 天前
SiYangUnityEventSystem,一个Unity中的事件系统
观察者模式·unity·c#·游戏引擎·事件系统
呆呆敲代码的小Y1 天前
【Unity实战篇】| 游戏滑动框添加特殊效果,如实时高亮显示、曲线滑动等
游戏·unity·游戏引擎·实战·u3d·免费游戏·unity实战技巧
Tatalaluola2 天前
【Quest开发】用unity UI快速实现交互
unity·游戏引擎
码界奇点2 天前
Unity WebGL输入支持终极指南解决浏览器输入难题的完整方案
unity·容器·游戏引擎·鸿蒙系统·webgl
90后小陈老师2 天前
Unity动画控制
unity·游戏引擎
Miss_SQ2 天前
Webgl打包后删除StreamingAssets文件夹下多余资源
unity·c#·webgl
Monkey_Xuan2 天前
C#中的引用传递和值传递
unity·c#
CreasyChan2 天前
C# LINQ 深度解析:优缺点与性能陷阱
unity·c#·游戏开发
freshman1182 天前
Unity动画控制
unity