I am wanting to make several menu screens of choices and then load the results during the game. For example:
Screen 1:
Choose Color: Red, Blue, Green, Yellow.
Screen 2:
Choose Vehicle: Type A, Type B, Type C.
Screen 3:
Choose Level: Beginner, Intermediate, Expert
Then load the results.
The way I’ve worked it out on paper, I would make a scene for each menu screen and link them in order. I assume the selection would somehow be saved as a variable and then called on when the game itself loads. How would I go about making the selections save across multiple screens? Any point in the right direction is greatly appreciated!
If you want to use multiple scenes there are two ways to do it I think.
Firstly, the easy way is to have a special gameobject that doesn’t destroy when you go between scenes. You can store all your data to scripts attached to this object. In one of the scripts just include the following code to preserve it between scenes (Unity - Scripting API: Object.DontDestroyOnLoad):
// Make this game object and all its transform children
// survive when loading a new scene.
void Awake(){
DontDestroyOnLoad (transform.gameObject);
}
The second method is to use playerprefs to save values, as these are actually saved between plays its an option I would possibly avoid. Unity - Scripting API: PlayerPrefs