From b6db76874b11bee6471aa0dd99d4ad3cfa26534c Mon Sep 17 00:00:00 2001 From: ousttrue Date: Thu, 24 Jun 2021 18:54:34 +0900 Subject: [PATCH] =?UTF-8?q?s=5FtypeMap=20=E3=82=92=E9=81=85=E5=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ScriptedImporter/RemapEditorBase.cs | 19 +++++++++++++++---- .../RemapScriptedImporterEditorBase.cs | 1 + 2 files changed, 16 insertions(+), 4 deletions(-) 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); }