We have an automated build script that builds our game. For the most part it works well. However, every once in a while we will see the following error:
Script compilation error: Couldn't replace Library/ScriptAssemblies/Assembly - CSharp - Editor.dll Loading script assembly "Library/ScriptAssemblies/Assembly - CSharp - Editor.dll" failed!
The problem seems related to modifying the source code assets and then immediately running the build script. I have attempted to force the refreshing of the assets, and locking of the assemblies to resolve the problem without much luck.
try
{
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
EditorApplication.LockReloadAssemblies();
/// build awesome stuff here...
}
finally
{
EditorApplication.UnlockReloadAssemblies();
}
The problem is that when we see this error, Unity does not build our main webplayer file with the latest player dll embedded in it. Instead it seems to be grabbing the one previous to our recent changes. Once in this state, the only way to get unity back to a known good state is to do a restart.
So has anyone found a way to ensure that the DLL's are not in the process of rebuilding during a build process???