TLDR:
- Adding a second scene causes unpredictable behavior in a large project where the code has many objects created with unspecified optional scene parameters
- Adding a flag to make scene parameters required would allow easier location of where I forgot to specify them
I have a fairly large project a little over 2 years old. Recently I added a second Scene and found that doing so caused several errors in observed behavior, but no errors in the console. I eventually realized this was because of not passing explicit scene parameters to several constructors spread across the codebase and the timing of my instantiation of the second scene causing some to be created in my first “main” scene and others created later being placed in the “secondary” scene due to the behavior that constructors use the most recently created scene if none is passed.
Now I need to sift through a lot of code and find every place that I didn’t provide a scene parameter in every constructor type where it is optional. It would be nice if I could turn on a compiler flag to change the scene parameters to be required then I could just go to the line in the error and fix them. As it is I’ll have to hunt down manually using grep and will likely miss some places.