static TimeTrackerTriggerUnityEditorKeystrokes() { System.Reflection.FieldInfo info = typeof(EditorApplication).GetField("globalEventHandler", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic); EditorApplication.CallbackFunction value = (EditorApplication.CallbackFunction)info.GetValue(null); value += () => { if (Event.current.type == EventType.KeyDown) { //we only need to trigger it every 10 seconds //doing to many triggers will just cause to many writes to disk without any need if ((DateTime.Now - lastTime).TotalSeconds > 10) { lastTime = DateTime.Now; TimeTracker.OnTrigger(); } } }; info.SetValue(null, value); }
static TimeTrackerTriggerOnScriptsRecompile() { TimeTracker.OnTrigger(); }
public void OnPreprocessBuild(BuildReport report) { TimeTracker.OnTrigger(); }
private static void OnChanged(object sender, FileSystemEventArgs e) { TimeTracker.OnTrigger(); }
private static void OnRenamed(object sender, RenamedEventArgs e) { TimeTracker.OnTrigger(); }
private static void LogPlayModeState(PlayModeStateChange state) { TimeTracker.OnTrigger(); }
static bool WantsToQuit() { TimeTracker.OnTrigger(); return(true); }
public static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { TimeTracker.OnTrigger(); }
public static string[] OnWillSaveAssets(string[] paths) { TimeTracker.OnTrigger(); return(paths); }