Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions AssetsTools.NET.MonoCecil/MonoCecilTempGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,27 @@ public AssetTypeTemplateField GetTemplateField(AssetTypeTemplateField baseField,
assemblyName += ".dll";
}

string assemblyPath = Path.Combine(managedPath, assemblyName);
if (!File.Exists(assemblyPath))
List<AssetTypeTemplateField> newFields = null;

// if the assembly is already loaded, use it
lock (loadedAssemblies)
{
return null;
if (loadedAssemblies.TryGetValue(assemblyName, out AssemblyDefinition asmDef))
{
newFields = Read(asmDef, nameSpace, className, unityVersion);
}
}

List<AssetTypeTemplateField> newFields = Read(assemblyPath, nameSpace, className, unityVersion);
// otherwise, try to read it from the managed path
if (newFields == null)
{
string assemblyPath = Path.Combine(managedPath, assemblyName);
if (!File.Exists(assemblyPath))
{
return null;
}
newFields = Read(assemblyPath, nameSpace, className, unityVersion);
}

AssetTypeTemplateField newBaseField = baseField.Clone();
newBaseField.Children.AddRange(newFields);
Expand Down