Crystal Defenders Maintenance Log - Keep your scenes flat
Added 2023-07-10 06:51:01 +0000 UTCIts the first "behind the scenes content" for y'all. Yay!
The latest update to Crystal Defenders has a bunch of quality of life improvements, but the one that was the most effort is a nice little perf bump just from me reorganizing basically every object in the scene and adopting this tool (https://assetstore.unity.com/packages/tools/utilities/hierarchy-folders-157716) which lets me keep the visual hierarchy but eliminate the empty folder objects when I build.
Sometimes the naive thing to do bites you later. Nesting stuff in a Unity scene for organization purposes can be that way. Turns out having a hierarchy nested like Game->Pools->Monster Pools -> Tortl Pool -> (50 instances of Tortl, which each have 3 sub-objects) is not *great*. Same with having projectile pools keep their spawned projectiles nested under them. Its great for looking at play mode and understanding what's going on at a glance, but very not good for the ole' CPU.
Part of the problem of course is just that VRC encourages this behaviour. Object Pools for networked prefabs need to have all their members instantiated *before* you build, and the inability to dynamically load scenes in any way basically locks you into one gigantic scene. You also can't really put code anywhere but GameObjects in VRC, so you end up with a *much* bigger hierarchy than you would have in a "real" Unity app.
Anyway, its better now, and I'm pushing the update out tonight.
I'll be spending my dev time this week on my standalone project (details coming here soon), and possibly throwing some of my stuff on Gumroad, while I think about the best way to handle making NG+ and difficulty settings a bit more interesting for Crystal Defenders down the line.
Check out the attached image for some stats about how big a difference this hierarchy optimization can make.