コード例 #1
0
        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);
        }
コード例 #2
0
 static TimeTrackerTriggerOnScriptsRecompile()
 {
     TimeTracker.OnTrigger();
 }
コード例 #3
0
 public void OnPreprocessBuild(BuildReport report)
 {
     TimeTracker.OnTrigger();
 }
コード例 #4
0
 private static void OnChanged(object sender, FileSystemEventArgs e)
 {
     TimeTracker.OnTrigger();
 }
コード例 #5
0
 private static void OnRenamed(object sender, RenamedEventArgs e)
 {
     TimeTracker.OnTrigger();
 }
コード例 #6
0
 private static void LogPlayModeState(PlayModeStateChange state)
 {
     TimeTracker.OnTrigger();
 }
コード例 #7
0
 static bool WantsToQuit()
 {
     TimeTracker.OnTrigger();
     return(true);
 }
コード例 #8
0
 public static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
 {
     TimeTracker.OnTrigger();
 }
コード例 #9
0
 public static string[] OnWillSaveAssets(string[] paths)
 {
     TimeTracker.OnTrigger();
     return(paths);
 }