Just getting into Unity and I have lots of reading and playing to do but a question as I wrap my head around all things Unity....
A full game has (at least) the following scenes (I understand that one should implement each of these as seperate scenes):
- Startup screen
- main menu
- game (multiple levels each being a scene)
- pause menu
- game exit menu/display
But I have not yet come across documentation that shows how to create multiple scenes in Unity under one project.
If I load the island demo (default) and create a new scene the original island demo scene disappears and I can't get back to it.
Also, how does one tie scenes together so that, for example, on the main menu if user click/select the 'Start Game' object then how to transition to the game scene from the main menu scene.
Pointers to documentation or answers for this appreciated.
Thanks for any help/pointers!
Welcome to Unity ;)
Unity doesn't keep scenes open as Tabs. You can only have one #Scene window open at a time.
But the Scene file did not disappear, it is available in the "Project" tab. You can even search for it by typing in characters in the area with the magnifying glass also on the Project tab.
And `Application.LoadLevel` is what you need to open a scene programmatically
And be sure to check out the fantastic Tutorials at Unity:
To manage which scenes load and in what order:
Choose File > Build Settings. From there you can add and remove scenes. To remove a scene just highlight it and hit Delete on your keyboard. You can also change their order by dragging and dropping the scene names.
The number to the right of the scene name denotes its loading order or index. i.e. 0, 1, 2.
Like in the Application.LoadLevel example:
// Loads the level with index 0
// Load the level named "HighScore".
It would be much easier to implement the pause menu as a GUI rather than it's own scene. If you want a placeholder for now, there is a good pause menu script in the wiki:
Simply attach that script to your camera and whenever you press the escape key, it will come up. You can extend or change the script (or completely replace it) to suit your needs later.
If you want to carry information from one scene to the next you can use the manager class:
Attach that script to an empty game object and call DontDestroyOnLoad() on that object to carry information from one scene to the next.
Hmm.. well you do scenes for different levels of a game and probably the main menu, but the pause menu or options menu is not such a good idea, you would literally load and unload the entire level each time you pause! depending on the size of your level that could take quite a while, you may be better off without a pause menu at all.
What you could do instead is to get your feet wet using the unity GUI API. It may seem daunting at first, but thanks to the well written API is not bad at all. Just go ahead to the Unity Gui section. Start coding the samples, and you should be all set (also in most cases you will only need two components, the label and the button)