Created
November 4, 2017 14:03
-
-
Save tsubaki/c96018dee07cef754a0207589c8b1484 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEngine.Profiling; | |
public class ExampleClass : MonoBehaviour | |
{ | |
Recorder behaviourUpdateRecorder; | |
void Start() | |
{ | |
// Profilerから”BehaviourUpdate”と名前の付く項目を抽出して、 | |
// 観測を有効化 | |
behaviourUpdateRecorder = Recorder.Get("BehaviourUpdate"); | |
behaviourUpdateRecorder.enabled = true; | |
} | |
void Update() | |
{ | |
// BehaviourUpdateが観測可能(EditorとDevelopment Players)なら、ログに処理時間(ミリ秒)を出力 | |
if (behaviourUpdateRecorder.isValid) | |
Debug.Log("BehaviourUpdate time: " + behaviourUpdateRecorder.elapsedNanoseconds); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://docs.unity3d.com/ScriptReference/Profiling.Recorder.html