Hi, at the moment, i have main menu scene, which can load to the game scene normally, my question is , i want Settings page on main menu where i can change some gameobject values that are in game scene ?
You have several options for this.
- For settings, probably the best thing is to store these values in PlayerPrefs. Then other code can pull them out of PlayerPrefs as needed, and they will even persist between runs of your game.
- You could also put the values on some GameObject on which you call DontDestroyOnLoad, which will make it survive the scene change into the next scene.
- Or, you could stuff the values into static variables, which are not associated with any object. So those values too survive the scene change.
But again, for game settings, option 1 is usually the best solution.
2 Likes
You can also create a ‘services’ scene. Then you can use additive loading to make sure the services scene hangs around for the whole game. Useful for things that require a bit more sophistication then playerprefs can offer.
1 Like