[unity] Skip loading SpineEditorUtilities in play mode.

This commit is contained in:
pharan 2018-12-11 03:12:37 +08:00 committed by GitHub
parent 1bd0347038
commit 987d074152
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -184,6 +184,8 @@ namespace Spine.Unity.Editor {
}
static void Initialize () {
if (EditorApplication.isPlayingOrWillChangePlaymode) return;
Preferences.Load();
var rootDir = new DirectoryInfo(Application.dataPath);
@ -201,15 +203,15 @@ namespace Spine.Unity.Editor {
EditorApplication.hierarchyWindowItemOnGUI += HierarchyHandler.HandleDragAndDrop;
// Hierarchy Icons
#if NEWPLAYMODECALLBACKS
#if NEWPLAYMODECALLBACKS
EditorApplication.playModeStateChanged -= HierarchyHandler.IconsOnPlaymodeStateChanged;
EditorApplication.playModeStateChanged += HierarchyHandler.IconsOnPlaymodeStateChanged;
HierarchyHandler.IconsOnPlaymodeStateChanged(PlayModeStateChange.EnteredEditMode);
#else
#else
EditorApplication.playmodeStateChanged -= HierarchyHandler.IconsOnPlaymodeStateChanged;
EditorApplication.playmodeStateChanged += HierarchyHandler.IconsOnPlaymodeStateChanged;
HierarchyHandler.IconsOnPlaymodeStateChanged();
#endif
#endif
// Data Refresh Edit Mode.
// This prevents deserialized SkeletonData from persisting from play mode to edit mode.
@ -281,6 +283,9 @@ namespace Spine.Unity.Editor {
static bool preferencesLoaded = false;
public static void Load () {
if (preferencesLoaded)
return;
defaultMix = EditorPrefs.GetFloat(DEFAULT_MIX_KEY, DEFAULT_DEFAULT_MIX);
defaultScale = EditorPrefs.GetFloat(DEFAULT_SCALE_KEY, DEFAULT_DEFAULT_SCALE);
defaultZSpacing = EditorPrefs.GetFloat(DEFAULT_ZSPACING_KEY, DEFAULT_DEFAULT_ZSPACING);