Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEditor;
- using UnityEngine;
- [InitializeOnLoad]
- static class Compiling {
- private static bool isCompiling {
- set { EditorPrefs.SetBool("IsCompiling", value); }
- get { return EditorPrefs.GetBool("IsCompiling"); }
- }
- private static double lastTimeCompiling {
- set { EditorPrefs.SetString("LastTimeCompiling", value.ToString()); }
- get { return double.Parse(EditorPrefs.GetString("LastTimeCompiling", EditorApplication.timeSinceStartup.ToString())); }
- }
- private static double compiledTime {
- get { return EditorApplication.timeSinceStartup - lastTimeCompiling; }
- }
- static Compiling() {
- EditorApplication.update += () => {
- if(EditorApplication.isCompiling == isCompiling)
- return;
- if(isCompiling = EditorApplication.isCompiling)
- lastTimeCompiling = EditorApplication.timeSinceStartup;
- else if(compiledTime > 0d)
- Debug.LogFormat("Compiled in {0} seconds", compiledTime.ToString("0.00"));
- };
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement