Why doesn't godot load all the corosponding scenes in the project?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By trinsic

I am new to Godot and learning how to use it. I’m working on the “My First Game” tutorial and it there are multiple scenes that are a part of this game. When I load the project only the main scene loads. Is there a way to have all the scenes load by default? I found some autoload settings and added the scenes (one at at time as I couldn’t select all of them, which is weird) and restarted the project but they did not load when I started the project. My project lives in a custom location so i don’t know if that is the issue or what. I noticed a custom data folder in the project settings. I was wondering if anyone can help me figure out why my scenes are not loading as I dont want to have to load them manually each time. Thank you.

You mean, load in the editor or load when running the game? Autoloads load when running the game.

exuin | 2021-06-25 17:33

1 Like
:bust_in_silhouette: Reply From: Wakatta

Answer

So in Editor Settings under the Editor tab look for and enable
interface > scene tabs > restore scenes on load

The reason

This option is not enabled by default because if you have large scenes it’ll take a long time for Godot to load and in some instances appear to hang or crash.

Confusion

So the Auto load option that you previously mentioned and used is for when the game starts, those scenes get loaded before your main scene node and can be accessed globally throughout your project only during gameplay

Tips

  • There is also an option for scripts to be remembered as well.
  • These options are more a matter of personal preference so have a look at all editor settings that might affect your ability to code

Thanks for the clear explanation and it makes sense to not load all the scenes in the project given that some scenes would take longer to load given the size.

So If I understand you correctly, if you open the project, and all the scenes for the game are NOT loaded, will it load the scenes if you run the project or will it just reference the scenes from the project location?

trinsic | 2021-07-10 16:14

Nice catch.
So the way it works is if a scene is opened when you close the project the next time you open said project those scenes will be reopened

This behavior is actually saved in the user dir for your project

Wakatta | 2021-07-10 17:14

Right, understood. But my questions was about if scenes were “NOT” loaded. If you pressed F5 and played the project, would it load the scenes into the game and run the game itself, or do the scenes still need to be loaded within the project for the game to function when you play the project?

trinsic | 2021-07-10 19:01

Oh icy

Only the Autoloaded scenes operate as you’ve described

All other scenes need to be instanced except the main scene which is set in the project settings. Since your curiosity has been sparked research scene switching

Wakatta | 2021-07-11 00:35

1 Like