Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by lauren_davison · Dec 14, 2015 at 06:06 PM · menusceneslinking

How do you link scenes together?

Does anyone know how I go about linking a game menu scene to another scene which would be the game itself?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by robin-theilade · Dec 14, 2015 at 06:35 PM

@lauren_davison, assuming you're using the new Unity GUI for creating the game menu this is the way I would load another scene from game menu.

1) You will need a script that handles the game menu. Something like this:

 using UnityEngine;
 
 /// <summary>
 /// Handles interaction with the game menu.
 /// </summary>
 public class GameMenu : MonoBehaviour
 {
     /// <summary>
     /// The name of the scene that contains the actual game.
     /// </summary>
     public string gameSceneName;
 
     /// <summary>
     /// Loads the actual game scene.
     /// </summary>
     public void StartGame()
     {
         Application.LoadLevel(this.gameSceneName);
     }
 }

2) Add this script to a game object in the game menu scene and enter the name of the scene that contains the actual game in the "Game Scene Name" field.

3) On the button that starts the actual game in the menu, assign the game object containing the GameMenu behaviour as "On Click()" handler and selects it's StartGame() function.

4) Make sure that both the game menu and actual game scenes are added to the list of scenes in the "Build Settings" window.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by G4merSylver · Dec 14, 2015 at 06:34 PM

SceneManager.LoadScene() or SceneManager.LoadScene

Create an button and attach an function with one of the upper, preferably the latter.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Jessespike · Dec 14, 2015 at 06:36 PM

You can write a script with functions that the UI will call.

 public class MainMenuCommands : MonoBehaviour {
 
     public void StartGame()
     {
         Application.LoadLevel("Game_Scene");
     }
 }

Then hook up the function to a button's OnClick Event.

ugui button onclick

The script doesn't have to be on the same GameObject, it's just here to show as an example.


button-onclick.jpg (17.9 kB)
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

How to keep overlay menu as I load different scenes. 0 Answers

Restart a Scene 1 Answer

Unity Project Id no longer exists or you no longer have permission to the Unity Project ID 0 Answers

How do I create a static bool? 1 Answer

Problem with give up -button 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges