Advertisement
Guest User

Untitled

a guest
Mar 24th, 2021
637
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.83 KB | None | 0 0
  1. using UnityEngine;
  2. using UnityEditor;
  3. using System.Collections;
  4.  
  5. class CompileTime : EditorWindow {
  6.    
  7.     bool isTrackingTime;
  8.     double startTime, finishTime, compileTime;
  9.  
  10.     [MenuItem("Window/Compile Times")]
  11.  
  12.     public static void Init() {
  13.         EditorWindow.GetWindow(typeof(CompileTime));
  14.     }
  15.  
  16.     void Update() {
  17.         if (EditorApplication.isCompiling && !isTrackingTime) {
  18.             startTime = EditorApplication.timeSinceStartup;
  19.             isTrackingTime = true;
  20.         }
  21.         else if (!EditorApplication.isCompiling && isTrackingTime) {
  22.             finishTime = EditorApplication.timeSinceStartup;
  23.             isTrackingTime = false;
  24.  
  25.             compileTime = finishTime - startTime;
  26.  
  27.             Debug.Log("Script compilation time:" + compileTime.ToString("0.000") + "s");
  28.         }
  29.     }
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement