diff --git a/Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/RemapEditorBase.cs b/Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/RemapEditorBase.cs index 9fd790ec0..b91a57190 100644 --- a/Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/RemapEditorBase.cs +++ b/Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/RemapEditorBase.cs @@ -14,7 +14,18 @@ namespace UniGLTF public abstract class RemapEditorBase { - public static Dictionary s_typeMap = new Dictionary(); + static Dictionary s_typeMap; + static Dictionary TypeMap + { + get + { + if (s_typeMap == null) + { + s_typeMap = new Dictionary(); + } + return s_typeMap; + } + } [Serializable] public struct SubAssetPair @@ -25,8 +36,8 @@ namespace UniGLTF [SerializeField] public String Name; - public SubAssetKey Key => new SubAssetKey(s_typeMap[Type], Name); - public ScriptedImporter.SourceAssetIdentifier ID => new AssetImporter.SourceAssetIdentifier(s_typeMap[Type], Name); + public SubAssetKey Key => new SubAssetKey(TypeMap[Type], Name); + public ScriptedImporter.SourceAssetIdentifier ID => new AssetImporter.SourceAssetIdentifier(TypeMap[Type], Name); [SerializeField] public UnityEngine.Object Object; @@ -34,7 +45,7 @@ namespace UniGLTF public SubAssetPair(SubAssetKey key, UnityEngine.Object o) { Type = key.Type.ToString(); - s_typeMap[Type] = key.Type; + TypeMap[Type] = key.Type; Name = key.Name; Object = o; } diff --git a/Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/RemapScriptedImporterEditorBase.cs b/Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/RemapScriptedImporterEditorBase.cs index b0631954a..bb879e863 100644 --- a/Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/RemapScriptedImporterEditorBase.cs +++ b/Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/RemapScriptedImporterEditorBase.cs @@ -51,6 +51,7 @@ namespace UniGLTF importer.RemoveRemap(kv.ID); } } + m_editMap.Clear(); AssetDatabase.WriteImportSettingsIfDirty(importer.assetPath); AssetDatabase.ImportAsset(importer.assetPath, ImportAssetOptions.ForceUpdate); }