Skip to content

Commit

Permalink
perf(UnityIntegration): only reload assemblies that changed
Browse files Browse the repository at this point in the history
To prevent Unity from reloading assemblies that weren't changed this
change introduces a check to only notify Unity when an assembly was
modified.
  • Loading branch information
Christopher - Marcel Böddecker committed Feb 24, 2019
1 parent 164877f commit 354296a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions Sources/FodyRunner.UnityIntegration/EditorWeaver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ private static void ManuallyWeaveAllAssemblies()
private static void WeaveAllAssemblies()
{
EditorApplication.LockReloadAssemblies();
bool didChangeAnyAssembly = false;

try
{
Expand All @@ -42,16 +43,22 @@ private static void WeaveAllAssemblies()
}

string sourceFilePath = assembly.sourceFiles.FirstOrDefault();
if (sourceFilePath != null)
if (sourceFilePath == null)
{
AssetDatabase.ImportAsset(sourceFilePath, ImportAssetOptions.ForceUpdate);
continue;
}

AssetDatabase.ImportAsset(sourceFilePath, ImportAssetOptions.ForceUpdate);
didChangeAnyAssembly = true;
}
}
finally
{
EditorApplication.UnlockReloadAssemblies();
AssetDatabase.Refresh();
if (didChangeAnyAssembly)
{
AssetDatabase.Refresh();
}
}
}

Expand Down

0 comments on commit 354296a

Please sign in to comment.