s_typeMap を遅延

This commit is contained in:
ousttrue
2021-06-24 18:54:34 +09:00
parent 8080bf7ab6
commit b6db76874b
2 changed files with 16 additions and 4 deletions

View File

@@ -14,7 +14,18 @@ namespace UniGLTF
public abstract class RemapEditorBase
{
public static Dictionary<String, Type> s_typeMap = new Dictionary<string, Type>();
static Dictionary<String, Type> s_typeMap;
static Dictionary<String, Type> TypeMap
{
get
{
if (s_typeMap == null)
{
s_typeMap = new Dictionary<string, Type>();
}
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;
}

View File

@@ -51,6 +51,7 @@ namespace UniGLTF
importer.RemoveRemap(kv.ID);
}
}
m_editMap.Clear();
AssetDatabase.WriteImportSettingsIfDirty(importer.assetPath);
AssetDatabase.ImportAsset(importer.assetPath, ImportAssetOptions.ForceUpdate);
}