Trial/course loading system changed!

Astral Court DX · published · build 26378568

I changed the way the game loads trials and such in all modes! This should hopefully prevent crashes during Endless Mode runs, but I haven't playtested this too much yet to make fully sure.

How did loading previously work for endless before? Well from my understanding of how Unity handles memory... Courses and the levels they contained were all loaded from object-references to them that were present at all times. These references all took up memory which is quite bad already (you may have noticed the game's memory goes up to 800 gigs during endless and that's why). But also, if an gameobject still has a reference to it somewhere (even if it has physically been deleted), its data will still be present in memory. So basically levels and course-data would load in and never get deleted, even if you progress to the next course. This would continue until the game couldn't handle it anymore and crash.

How does it work now? All course data is stored in a resource folder that's not in memory. When the Level-Player wants to load a new course, it'll go to that folder and find a course to load into memory. When the game needs to get a new course, the previous one gets deleted. Since there are no object-references to the previous course, it should be gone from memory for good. It finds these courses through a list that stores only the names of each, and then goes through the file path of "Resources/Level Assets/Endless Assets/" to grab the course. Only downside to this is that each course takes a little bit longer to load now, but that's way better than crashing. It also means that Endless Mode's initial load-time, when starting a run, is much faster.

Okay that's all! If anyone encounters any issues, please let me know!! Byee, have a good day/night!