How do i give extra values when loading a scene?

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

I have a menu scene, and a game scene, so how do I do something in the level scene with a value from the menu?

:bust_in_silhouette: Reply From: aXu_AP

Here’s 3 options:

  1. Have a global singleton class that carries the information over. Before you change the scene, save needed information in that singleton. For game settings, this makes the most sense. (see docs)

  2. Make custom scene switcher. Here’s docs how to do it (it’s not as hard as might sound). There you can pass wanted parameters to next scene. This is great if you want to pass entry point in to next level (for example, which door player went through).

  3. Don’t unload the menu - just hide it. This is good for simple pause menus.