简体   繁体   中英

Getting the Rendering time of a Unity Game scene on Android

在Android平台上运行时,如何获取(并记录)统一游戏中场景的确切渲染时间统一渲染部分所需的时间 )( 不使用探查器作为探查器会增加一些额外的开销)

I don't know of any available API call. Time.unscaledDeltaTime is the real-time between calls to Update() (so includes gpu and cpu processing). The best I can offer is, based off of the lifecycle linked in OP's comments, start a timer immediately before the Render part and stop it immediately after using:

private void LateUpdate()
{
    StartCoroutine(RenderTimer());
}

IEnumerator RenderTimer()
{
    var started = YourHiResTimerHere.Now;

    yield return new WaitForEndOfFrame();

    var ended = YourHiResTimerHere.Now;
    var gpuWait = ended - started;
}

Keep in mind that most C# timers have terrible resolution (about 20ms at best)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM