4
4
using System . Reflection ;
5
5
using UnityEditor ;
6
6
7
- namespace SatorImaging . UnitySourceGenerator
7
+ namespace SatorImaging . UnitySourceGenerator . Editor
8
8
{
9
9
public static class EditorEvent
10
10
{
@@ -24,7 +24,8 @@ internal static void RegisterFocusChangedEvent(bool registerOrRemove)
24
24
//https://github.com/Unity-Technologies/UnityCsReference/blob/master/Editor/Mono/EditorApplication.cs#L275
25
25
var focusChanged = typeof ( EditorApplication ) . GetField ( "focusChanged" ,
26
26
BindingFlags . Static | BindingFlags . NonPublic ) ;
27
- if ( focusChanged == null ) return ;
27
+ if ( focusChanged == null )
28
+ return ;
28
29
29
30
// TODO: better cleanup.
30
31
// currently, event can be unregistered but it seems empty action runs on focus changed event...?
@@ -50,32 +51,33 @@ internal static void RegisterFocusChangedEvent(bool registerOrRemove)
50
51
//Debug.Log($"[USG] Null? {currentAction == null} Method:{currentAction.Method} Target:{currentAction.Target}");
51
52
52
53
_restoreAutoRefresh = EditorPrefs . GetInt ( PREF_AUTO_REFRESH , EditorPrefs . GetInt ( PREF_AUTO_REFRESH_OLD , DEFAULT_AUTO_REFRESH ) ) ;
53
- _restoreDirMonitoring = EditorPrefs . GetBool ( PREF_DIR_MONITORING , DEFAULT_DIR_MONITORING ) ;
54
+ // _restoreDirMonitoring = EditorPrefs.GetBool(PREF_DIR_MONITORING, DEFAULT_DIR_MONITORING);
54
55
}
55
56
56
57
const bool DEFAULT_DIR_MONITORING = true ;
57
58
const int DEFAULT_AUTO_REFRESH = 1 ;
58
59
const string PREF_AUTO_REFRESH = "kAutoRefreshMode" ;
59
60
const string PREF_AUTO_REFRESH_OLD = "kAutoRefresh" ;
60
- const string PREF_DIR_MONITORING = "DirectoryMonitoring" ;
61
- static bool _restoreDirMonitoring = DEFAULT_DIR_MONITORING ;
61
+ // const string PREF_DIR_MONITORING = "DirectoryMonitoring";
62
+ // static bool _restoreDirMonitoring = DEFAULT_DIR_MONITORING;
62
63
static int _restoreAutoRefresh = DEFAULT_AUTO_REFRESH ;
63
64
static void OnEditorApplicationFocus ( bool focus )
64
65
{
65
66
//https://github.com/Unity-Technologies/UnityCsReference/blob/master/Editor/Mono/PreferencesWindow/AssetPipelinePreferences.cs#L94
66
67
if ( focus == false )
67
68
{
68
69
_restoreAutoRefresh = EditorPrefs . GetInt ( PREF_AUTO_REFRESH , EditorPrefs . GetInt ( PREF_AUTO_REFRESH_OLD , DEFAULT_AUTO_REFRESH ) ) ;
69
- _restoreDirMonitoring = EditorPrefs . GetBool ( PREF_DIR_MONITORING , DEFAULT_DIR_MONITORING ) ;
70
+ //_restoreDirMonitoring = EditorPrefs.GetBool(PREF_DIR_MONITORING, DEFAULT_DIR_MONITORING);
71
+
70
72
//AssetDatabase.DisallowAutoRefresh();
71
73
EditorApplication . LockReloadAssemblies ( ) ;
72
- EditorPrefs . SetBool ( PREF_DIR_MONITORING , false ) ;
74
+ // EditorPrefs.SetBool(PREF_DIR_MONITORING, false);
73
75
EditorPrefs . SetInt ( PREF_AUTO_REFRESH , 0 ) ;
74
76
EditorPrefs . SetInt ( PREF_AUTO_REFRESH_OLD , 0 ) ;
75
77
}
76
78
else
77
79
{
78
- EditorPrefs . SetBool ( PREF_DIR_MONITORING , _restoreDirMonitoring ) ;
80
+ // EditorPrefs.SetBool(PREF_DIR_MONITORING, _restoreDirMonitoring);
79
81
EditorPrefs . SetInt ( PREF_AUTO_REFRESH , _restoreAutoRefresh ) ;
80
82
EditorPrefs . SetInt ( PREF_AUTO_REFRESH_OLD , _restoreAutoRefresh ) ;
81
83
0 commit comments