unity 渲染帧率优化-OnDemandRendering

FixedUpdate更新速率设置
OnDemandRendering 相关的API:

(1)
OnDemandRendering.renderFrameInterval = 3;

解释说明:
在一些静态UI的时候把OnDemandRendering.renderFrameInterval设置为3,表示渲染频率降为1/3。假设正常是30fps,那么渲染帧率就是10fps。但是在iOS手机上测试后发现一个问题,画面表现为透明的UI在一层层地叠加。

(2)
垂直同步 开启和不开启 帧率的计算是不一样的:

(2.1)开启了垂直同步:
If QualitySettings.vSyncCount is greater than 0 it is calculated by:
FPS = Resolution.refreshRate / QualitySettings.vSyncCount / OnDemandRendering.renderFrameInterval
FPS = 设备分辨率的刷新 / 垂直同步等级/ 渲染刷新间隔

(2.2)未开启垂直同步:

If QualitySettings.vSyncCount is 0 and Application.targetFrameRate is also greater than 0:
FPS = Application.targetFrameRate / OnDemandRendering.renderFrameInterval

FPS = 目标帧率 / 渲染刷新间隔

在这里插入图片描述

在这里插入图片描述
(3).另外还有两个API:

bool = OnDemandRendering.willCurrentFrameRender

扫描二维码关注公众号,回复: 13265412 查看本文章

int = OnDemandRendering.effectiveRenderFrameRate

比较鸡肋, 但是可以在调试和查看时设置,方便更好的理解 OnDemandRendering.renderFrameInterval !!!

加深理解:OnDemandRendering中文描述
详见: unity官方文档!!!!!

猜你喜欢

转载自blog.csdn.net/js0907/article/details/118249294