Created
June 10, 2021 07:23
-
-
Save unitycoder/498231e7f7f08a6b755e0b367f703c46 to your computer and use it in GitHub Desktop.
measure compile time unity editor
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 characters
| // https://forum.unity.com/threads/compile-times-twice-as-long-then-previous-versions.1123711/ | |
| using UnityEngine; | |
| using UnityEditor; | |
| using System.Collections; | |
| class CompileTime : EditorWindow { | |
| bool isTrackingTime; | |
| double startTime, finishTime, compileTime; | |
| [MenuItem("Window/Compile Times")] | |
| public static void Init() { | |
| EditorWindow.GetWindow(typeof(CompileTime)); | |
| } | |
| void Update() { | |
| if (EditorApplication.isCompiling && !isTrackingTime) { | |
| startTime = EditorApplication.timeSinceStartup; | |
| isTrackingTime = true; | |
| } | |
| else if (!EditorApplication.isCompiling && isTrackingTime) { | |
| finishTime = EditorApplication.timeSinceStartup; | |
| isTrackingTime = false; | |
| compileTime = finishTime - startTime; | |
| Debug.Log("Script compilation time:" + compileTime.ToString("0.000") + "s"); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment