Hi Guys,
Any tips on optimizing compile times for AC projects? I have a lot of custom code and would love to prevent AC from having to recompile with every change. I generally follow the "move 3rd party assets into /Plugins/ folder" - but AC doesn't seem to like this in my initial trials.
Anyone else found ways to improve compile time of AC?
Thanks,
Sebastian
Comments
TypeLoadException: Could not load type 'AC.OptionsData'.
System.Reflection.Assembly.GetType (System.String name, Boolean throwOnError, Boolean ignoreCase) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/Assembly.cs:398)
1) Create the new folder and move AC to it
2) In Resource.cs, modify the "mainFolderPath" variable to point to the new directory
3) In ActionsManager.cs, modify the "folderPath" variable to point to the new Actions directory
4) In your Actions Manager UI, clear or re-assign your custom Actions folder
5) Restart Unity
The issue looks to be related to deserializing the Options data in Binary, so I'm not sure how moving the folder can have such an effect. Does the AC Game Editor etc all load correctly (i.e. the issue is only once the game is run)?
I did the same tests I mentioned above in addition to the generic folder name you suggested using a fresh project and the 3D demo... it does indeed have to do with the special folder assemblies. Moving into a "FolderTest" and updating the location as you specified does without any serialization issues (but of course no improvement to compilation time either).
Clicking through the AC editor windows does indeed create a bunch of errors when inside the special folders as well.
I've read and re-read the Unity docs regarding the compilation order and special folder handling and can't figure out why this would cause issues - but am admittedly no expert.
Fortunately, XML saving seems to work just fine - so it's just a matter of enforcing it:
void OnEnable ()
{
SaveSystem.FileFormatHandler = new FileFormatHandler_Xml ();
}
(See the "Custom save formats and handling" chapter of the Manual for more on this)
Put that in a new C# Monobehaviour script and place it in your scene before running the game / Editor window. Works for me from then on. Of course, you might not want save files to save in XML format - but I guess you could just move everything back when you're ready to publish.
I suggest that you change the main scripts folder structure (excluding the demos) to be
Runtime
Editor
and an assembly definition file in each of them with respective settings.
Since I usually modify the assets I use I move them to custom package folder. So it would be great if it can be moved to a custom package folder as it is without breaking.
I managed to get it working by this assembly definition file settings in custom packages folder
https://pasteboard.co/JHCPlxE.png
https://pasteboard.co/JHCPDYL.png
The demos are still in the assets folder and it seems I can play them fine.
However resources had to be fixed like this
and in GetOrCreateSettings I did the following
Now it works fine in the package and I think it should work fine too in the assets folder.
A small correction I had to do. packageID is now hard coded. I hope there's a way to get the package id from script.
ActionManager.cs little fix. You get the idea, I am still working on it, but it's totally doable.
public string FolderPath
{
get
{
return Resource.MainFolderPathRelativeToAssets + "/Scripts/Runtime/Actions";
}
}
Thank you for the suggestions, @stranger.
I'm wary of making any official change that involves referencing assets while changing locations, as Unity doesn't respect changed locations when re-importing pre-existing assets. Though, your steps are helpful to those looking to make such changes manually.
@ChrisIceBox
Thank you for your comment. You are right. It would be best if unity have plugin and editor extensions from asset store to be installed as a package so that they are not part of the main repository.
It would be useful if the same plugin is used in multiple projects and have internal modification used by the studio.
I am not sure if this change is coming soon to the asset store though.