Version: 2021.3
LanguageEnglish
  • C#

OnDemandRendering

class in UnityEngine.Rendering

/

Implemented in:UnityEngine.CoreModule

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

Use the OnDemandRendering class to control and query information about your application's rendering speed independent from all other subsystems (such as physics, input, or animation).

If you use this with Optimized Frame Pacing on Android, and if you're also using OpenGL ES, Optimized Frame Pacing is most effective when the frame rate is either 20, 30, or 60 frames per second. To make sure that you render at one of these frame rates, use OnDemandRendering.effectiveRenderframerate.

Vulkan is less strict and allows a greater number of valid frame rates.

If you request an incompatible frame rate, the application renders at the highest frame rate possible. However, if the renderFrameInterval is too high, the application might become unresponsive because the time between rendered frames also becomes too high.

Note about event execution:
The diagram on this page describes the execution order for events in each frame. However, render-specific events, including those for Scene rendering, Gizmo rendering, GUI rendering, and End of frame sections, don't occur during frames that Unity doesn't render (when OnDemandRendering.willCurrentFrameRender is false).

Static Properties

effectiveRenderFrameRateThe current estimated rate of rendering in frames per second rounded to the nearest integer.
renderFrameIntervalGet or set the current frame rate interval. To restore rendering back to the value of Application.targetFrameRate or QualitySettings.vSyncCount set this to 0 or 1.
willCurrentFrameRender True if the current frame will be rendered.
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961