diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/SpineEditorUtilities.cs b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/SpineEditorUtilities.cs index 7efdc414b..dccc65417 100644 --- a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/SpineEditorUtilities.cs +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/SpineEditorUtilities.cs @@ -69,6 +69,7 @@ namespace Spine.Unity.Editor { public static string editorPath = ""; public static string editorGUIPath = ""; public static bool initialized; + private static int numFramesToDelayInit = 1; private static List texturesWithoutMetaFile = new List(); // Auto-import entry point for textures @@ -96,11 +97,16 @@ namespace Spine.Unity.Editor { } #region Initialization + static SpineEditorUtilities () { - Initialize(); + EditorApplication.update += Initialize; // delayed so that AssetDatabase is ready. } static void Initialize () { + if (numFramesToDelayInit-- > 0) + return; + EditorApplication.update -= Initialize; + // Note: Preferences need to be loaded when changing play mode // to initialize handle scale correctly. #if !NEW_PREFERENCES_SETTINGS_PROVIDER