Cleaning up the implementation and setup for when jumping between levels, with various items that might change for each level. Such as camera setup, sky boxes and UI elements that need to be hidden or tucked away. So, the game controller handles loading the levels, and when a level is done loading it calls this little helper method.
void SetupLevel() { Type setupType = Type.GetType(Application.loadedLevelName); SceneSetup pSS = (SceneSetup)Activator.CreateInstance(setupType); if (pSS!= null) { pSS.Initalize(); } }
By using some reflection, I can easily just instantiate the classes that match the name of the level and run its initialize method to setup whatever needs to be setup. This might not be the best way to go about this, but it is quite simple and makes it easy for me to create configuration logic based on what is being loaded. Not having numerous different prefabs that get loaded based on the level you are working with makes the core setup simpler also.
Finding good solutions to grow from will help you gain a good momentum later on and should assist in great ways with stability and testing. Getting things up and running fast with hacking and experimentation has great value for seeing what is doable and how to do accomplish things. But, if you have the opportunity, you should spoil yourself and implement things in a way that minimizes maintainability. Rework things until you can account for most problems you need to solve.
I don’t write unit tests for my scripted game features. I try to utilize the feature the game engine gives me and keep the actual implementation as simple as possible. The libraries and utilities I create as dynamic libraries, I do write tests for. Going religious about coverage and treating software development like a game of statistics is a sure way of moving the focus of creating good software where its users attest for its quality, to where you equate its quality to a few columns in a spread sheet. When the face of software becomes just data points, you are most likely just hiring programmers who fit well into such criteria also. I would call such statistical development extremes, a “Dissociative Development Disorder”.
Anyway, I need to continue.