Reputation: 326
I'm building some sort of Mario party / mini game game. In my main scene you select how many players are playing, which characters will play and they will be put in my "GameManager" script which has a DontDestroyOnLoad so all scenes have this information (plus all the prefabs are loaded under this GameManager object).
My problem is that when I'm creating/editing a scene for a mini game, I can't press play in the Unity Editor to play the scene, since I don't have the GameManager with all the information (since it's initiated in the first scene), so my solution for now is setting a "Test mode" in my Main scene, where I enter the scene name and then play the Main scene which instantiates test players and loads the mini game scene.
That means everytime I want to test something I have to select the Main scene and press play, then go back my mini game scene to adjust, then back to the Main scene and so on.
Does anyone know of a better solution for this?
Upvotes: 0
Views: 49
Reputation: 4283
If I understood your problem, you have to use "persistent data".
What I recommend is to set a file, like a JSON file, and set the default values you want to use on your "GameManager" when you pass from main to "mini-game" scene. Then use a compiler conditional like "#if UNITY_EDITOR
" and create a call that instantiates an "auxiliar" GameManager which is filled with your JSON file data.
That allows you to use the same system for every mini-game you pretend to use, and for every other separated scene which demmands a filled GameManager.
Hope it helps!
Upvotes: 0