diff --git a/spine-unity/Assets/spine-unity/Editor/SpineEditorUtilities.cs b/spine-unity/Assets/spine-unity/Editor/SpineEditorUtilities.cs index e6b0f0605..309cfeb25 100644 --- a/spine-unity/Assets/spine-unity/Editor/SpineEditorUtilities.cs +++ b/spine-unity/Assets/spine-unity/Editor/SpineEditorUtilities.cs @@ -155,16 +155,17 @@ namespace Spine.Unity.Editor { public static string editorGUIPath = ""; public static bool initialized; - /// This list keeps the asset reference temporarily during importing. + /// HACK: This list keeps the asset reference temporarily during importing. /// /// In cases of very large projects/sufficient RAM pressure, when AssetDatabase.SaveAssets is called, /// Unity can mistakenly unload assets whose references are only on the stack. /// This leads to MissingReferenceException and other errors. static readonly List protectFromStackGarbageCollection = new List(); - static HashSet assetsImportedInWrongState; - static Dictionary skeletonRendererTable; - static Dictionary skeletonUtilityBoneTable; - static Dictionary boundingBoxFollowerTable; + static HashSet assetsImportedInWrongState = new HashSet(); + + static Dictionary skeletonRendererTable = new Dictionary(); + static Dictionary skeletonUtilityBoneTable = new Dictionary(); + static Dictionary boundingBoxFollowerTable = new Dictionary(); #if SPINE_TK2D const float DEFAULT_DEFAULT_SCALE = 1f; @@ -220,11 +221,6 @@ namespace Spine.Unity.Editor { Icons.Initialize(); - assetsImportedInWrongState = new HashSet(); - skeletonRendererTable = new Dictionary(); - skeletonUtilityBoneTable = new Dictionary(); - boundingBoxFollowerTable = new Dictionary(); - // Drag and Drop SceneView.onSceneGUIDelegate -= SceneViewDragAndDrop; SceneView.onSceneGUIDelegate += SceneViewDragAndDrop; @@ -535,15 +531,15 @@ namespace Spine.Unity.Editor { SkeletonRenderer[] arr = Object.FindObjectsOfType(); foreach (SkeletonRenderer r in arr) - skeletonRendererTable.Add(r.gameObject.GetInstanceID(), r.gameObject); + skeletonRendererTable[r.gameObject.GetInstanceID()] = r.gameObject; SkeletonUtilityBone[] boneArr = Object.FindObjectsOfType(); foreach (SkeletonUtilityBone b in boneArr) - skeletonUtilityBoneTable.Add(b.gameObject.GetInstanceID(), b); + skeletonUtilityBoneTable[b.gameObject.GetInstanceID()] = b; BoundingBoxFollower[] bbfArr = Object.FindObjectsOfType(); foreach (BoundingBoxFollower bbf in bbfArr) - boundingBoxFollowerTable.Add(bbf.gameObject.GetInstanceID(), bbf); + boundingBoxFollowerTable[bbf.gameObject.GetInstanceID()] = bbf; } static void HierarchyIconsOnGUI (int instanceId, Rect selectionRect) {