- Home /
newbie.... connecting scenes together to make a game?
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 etc.
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!
Answer by Julian-Glenn · Aug 10, 2010 at 05:48 PM
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
http://unity3d.com/support/documentation/ScriptReference/Application.LoadLevel.html
And be sure to check out the fantastic Tutorials at Unity:
http://unity3d.com/support/resources/tutorials/
EDIT/////
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
Application.LoadLevel (0);
or
// Load the level named "HighScore".
Application.LoadLevel ("HighScore");
Ahh... Ohh... I see... there it is under project->scenes... :-) !
Thank you.
Follow up...
So, how is the first scene/level loaded on startup of the game?
Updated answer to include info. If it helped can you mark as answered. ty
great help this one, i just spent a while tryin to figure out how to implement a 'title' scene and a 'game' scene.
thank you for the advice, as i didnt have any listed in the project builder window, just added current then dragged the other one in, and all nicely indexed now :)
thumbs up
Answer by acmshar · Aug 10, 2010 at 08:59 PM
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.
A good resource for the Pause menu. Thanks!
The A$$anonymous$$anager class sounds great but I'm not "mentally" there yet. Should be a short time from now...
Answer by Azrael · Aug 10, 2010 at 08:23 PM
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)
well written API? Unity's GUI API? The bunch of static functions?
Your answer
Follow this Question
Related Questions
Can you play a cutscene when entering an area? 0 Answers
How to make the level screen????? 0 Answers
Go to next scene when correct answer 3 Answers
how do i Disable and Enable buttons? 2 Answers
Quit application before relaunching to specific scene 1 Answer