Last active
October 7, 2024 12:27
-
-
Save yasirkula/2a7b5c3a678215a7e819144f63964806 to your computer and use it in GitHub Desktop.
Revisions
-
yasirkula revised this gist
Feb 27, 2024 . 1 changed file with 16 additions and 10 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,14 +1,20 @@ using UnityEditor; using UnityEngine; public class BenchmarkEnterPlayMode { [InitializeOnLoadMethod] private static void Initialize() { void OnPlayModeStateChanged( PlayModeStateChange state ) { if( state == PlayModeStateChange.ExitingEditMode || state == PlayModeStateChange.ExitingPlayMode ) SessionState.SetFloat( "state_exit_time", (float) EditorApplication.timeSinceStartup ); else Debug.Log( state + " in: " + ( (float) EditorApplication.timeSinceStartup - SessionState.GetFloat( "state_exit_time", 0f ) ) ); } EditorApplication.playModeStateChanged -= OnPlayModeStateChanged; EditorApplication.playModeStateChanged += OnPlayModeStateChanged; } } -
yasirkula created this gist
Feb 27, 2024 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ [InitializeOnLoadMethod] private static void BenchmarkEnterPlayMode() { void OnPlayModeStateChanged( PlayModeStateChange state ) { if( state == PlayModeStateChange.ExitingEditMode || state == PlayModeStateChange.ExitingPlayMode ) SessionState.SetFloat( "state_exit_time", (float) EditorApplication.timeSinceStartup ); else Debug.Log( state + " in: " + ( (float) EditorApplication.timeSinceStartup - SessionState.GetFloat( "state_exit_time", 0f ) ) ); } EditorApplication.playModeStateChanged -= OnPlayModeStateChanged; EditorApplication.playModeStateChanged += OnPlayModeStateChanged; }