版本: Unity 6 (6000.0)
语言English
  • C#

OnDemandRendering.willCurrentFrameRender

建议修改

成功!

感谢您帮助我们提高 Unity 文档的质量。虽然我们无法接受所有提交,但我们确实会阅读用户提出的每一项修改建议,并在适用的情况下进行更新。

关闭

提交失败

由于某些原因,您的修改建议无法提交。请<a>稍后再试</a>。感谢您抽出时间帮助我们提高 Unity 文档的质量。

关闭

取消

public static bool willCurrentFrameRender;

描述

如果当前帧将被渲染,则为True

using UnityEngine;
using UnityEngine.Rendering;

// This example shows how to determine if the current frame will be presented to the screen. public class Example : MonoBehaviour { void Start() { QualitySettings.vSyncCount = 0; Application.targetFrameRate = 60; OnDemandRendering.renderFrameInterval = 3; }

// Output will be: // // Will this frame render? False // Will this frame render? False // Will this frame render? True // Will this frame render? False // Will this frame render? False // Will this frame render? True void Update() { Debug.Log("Will this frame render? " + OnDemandRendering.willCurrentFrameRender);

if (!OnDemandRendering.willCurrentFrameRender) { // Frames that are not rendered may have some extra CPU cycles to spare for processes that would otherwise be too much of a burden. // For example: expensive math operations, spawning prefabs or loading assets. } } }