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?

@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.

SceneManager.LoadScene() or SceneManager.LoadScene

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

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.

60005-button-onclick.jpg

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