Skip to content

Commit b478c7b

Browse files
committed
Fixes to gui with enableInEdit mode
Admittedly this should have been in #12. However, here are the fixes anyways. GUI buttons to un/load show in edit mode if enableInEditMode is true. Disabling and re-enabling the DllManipulatorScript works now.
1 parent 3d11bc8 commit b478c7b

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

scripts/DllManipulatorScript.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ private void OnEnable()
4646
{
4747
if (EditorApplication.isPlaying)
4848
Destroy(gameObject);
49-
else
49+
else if(_singletonInstance != this)
5050
enabled = false; //Don't destroy as the user may be editing a Prefab
5151
return;
5252
}

scripts/Editor/DllManipulatorEditor.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ public override void OnInspectorGUI()
117117

118118

119119
bool unloadAll;
120-
if(EditorApplication.isPlaying && t.Options.threadSafe)
120+
if((EditorApplication.isPlaying || t.Options.enableInEditMode) && t.Options.threadSafe)
121121
unloadAll = GUILayout.Button(UNLOAD_ALL_DLLS_WITH_THREAD_SAFETY_GUI_CONTENT);
122-
else if (EditorApplication.isPlaying && !EditorApplication.isPaused && t.Options.loadingMode == DllLoadingMode.Preload)
122+
else if ((EditorApplication.isPlaying && !EditorApplication.isPaused || t.Options.enableInEditMode) && t.Options.loadingMode == DllLoadingMode.Preload)
123123
unloadAll = GUILayout.Button(UNLOAD_ALL_DLLS_IN_PLAY_PRELOADED_GUI_CONTENT);
124124
else
125125
unloadAll = GUILayout.Button("Unload all DLLs");
@@ -130,7 +130,7 @@ public override void OnInspectorGUI()
130130

131131
DrawUsedDlls(usedDlls);
132132
}
133-
else if(EditorApplication.isPlaying)
133+
else if(EditorApplication.isPlaying || t.Options.enableInEditMode)
134134
{
135135
GUILayout.BeginHorizontal();
136136
GUILayout.FlexibleSpace();
@@ -139,7 +139,7 @@ public override void OnInspectorGUI()
139139
GUILayout.EndHorizontal();
140140
}
141141

142-
if(EditorApplication.isPlaying && t.InitializationTime != null)
142+
if((EditorApplication.isPlaying || t.Options.enableInEditMode) && t.InitializationTime != null)
143143
{
144144
EditorGUILayout.Space();
145145
EditorGUILayout.Space();

0 commit comments

Comments
 (0)