For new projects Unity is really fast. However, the more scripts and assets are the project the slower it gets, until it becomes nearly unusable even for a medium sized project. What have other teams done to mitigate this?
To explain further, my project Empire of Ember is 91 GB for the assets directory. It builds to about 10 GB. There have been larger games made with Unity larger than this, such as Pathfinder Kingmaker.
I’m not sure if they suffered through the same problem with Pathfinder Kingmaker, but I spend roughly half my day waiting for Unity. Loading the Editor takes about 6 minutes. Clicking on a prefab freezes the editor for 3 seconds (it adds up). Loading the game takes about 2 minutes. This is after spending extensive effort profiling the editor, cleaning unused assets, using domain reloading, and every other tip I could find.
As best I can tell from debugging constructor calls the problem is due to how Unity references assets. If I click a scriptable object that has a reference to a building, Unity actually loads the building too. If the building references characters, those get loaded. If the characters reference weapons, those get loaded.
This seems to snowball to the garbage collector, which can end up freezing the editor for minutes even if I just load an empty or nearly empty scene.
Unreal seems to be more widely used for large games, and right now we’re looking at developing the sequel in Unreal because I don’t think they have this same scalability problem (but I could be wrong).
Is your computer significantly out of date? Are you using fast SSD storage?
My largest project is a bit smaller than yours, with a 20GB asset folder, but I just timed it and the project opens in 35 seconds (4800h laptop, 16GB ram, ssd). The biggest assets I have are some enormous terrains. But I have them all in their own separate scenes, so I only ever load one of these sets of terrains at any given time (and only if I’m working on that terrain, which is not often).
If you’ve got a spiderweb of inspector references everywhere, the entire tree of references all have to be loaded into memory each time. For example, if you have 100 weapons prefabs in your game, and you reference them all on your character prefabs, when you load the character prefabs you also have to load the 100 weapons prefabs, since all references will be loaded. If you switched to say a weapon prefab manager singleton which had references to all the weapons prefabs, and you get the weapons at runtime from the singleton, then you wouldn’t need to load the weapons prefabs when you work on the character prefabs - only when you load the weapon prefab manager would you end up waiting to load the weapons, and if that was pretty heavy you can move it to its own additive scene so usually you wouldn’t need to load it in the editor.
Additive scenes are very powerful for deciding what you want to load now, and what you don’t, so long as you resist referencing your assets outside of the specific additive scene you want to load them from.
Thanks for the response! I have the fastest computer you can buy basically, with the fastest consumer SSD.
The problem in my case is not that my scriptable object references every building, but that if it even references one building it then appears references everything that building references too, recursively. It shouldn’t load the building at all, what should happen is it references some ID on disk that is only looked up if I actually use it. I base that assertion on constructors being called that only exist on the building, but get called when I click on the scriptable object that references the building.