Main Scene vs Autoload for Transitions
Hello, I am working on scene transitions in my game, and I am wondering what architecture people prefer. I am considering:
A: Have a main scene that loads each scene and adds/removes children at transition time. Persistent data can exist in the main scene.
B: Use change_scene() to transition between scenes and keep persistent data in Autoload scripts.
Are there any advantages/disadvantages to these two approaches? Do you have a preferred method for your games?
Posted Nov 5, 2022, 7:51 PM UTC
Definitely A for more fine control. Autoloads aren't needed for persistent data but are better suited for functionality that needs to be available from everywhere at any time. Moving from level to level is often a one-off task handled by one or a few scripts, i.e neither the logic nor the functionality needs to be global. That said, sometimes they can be a helpful design shortcut if done in moderation. I guess the point is that it should be considered whether they are suitable for the situation.