Unity: Switch between scenes

Introduction

Prerequisites

  1. Unity game project (either 2D or 3D is fine)
  2. Two scenes: the tutorial below will guide you in creating the scenes
  3. Basic knowledge of C# programming

Steps

Select “Rename” to change the scene name
Click Reload
Add a UI button into the scene
The original camera area is at the lower-left corner (the tiny little rectangle)
Finally aligned with the Camera area
Looks basic now
Something like this
The default template for a Unity C# script
using UnityEngine.SceneManagement;
public void ClickStart() {
SceneManager.LoadScene("GameScene");
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class TitleSceneController : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{

}
// Update is called once per frame
void Update()
{

}
public void ClickStart()
{
SceneManager.LoadScene("GameScene");
}

}
Select the Main Camera as the object, then select ClickStart()
You can see all 2 scenes have been added to the Build Settings dialog

Completed Project

--

--

--

I write stuffs: novels, programs, mobile apps, journal papers, book chapters, etc.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Programming on Hard Mode: iPad Pro as a game development workstation

<p> Hello World! </p>

Scaling Engineering — How Reddit was able to Triple in Size

On accessibility of burgers

Multipetabyte RAIDIX Based Storage for HPC Infrastructure

#freestockphoto (Monday 16th 08AM)

How to distribute Flutter Desktop app binaries using GitHub Actions

Why I code?

old wizard in front of a computer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Raptor Kwok

Raptor Kwok

I write stuffs: novels, programs, mobile apps, journal papers, book chapters, etc.

More from Medium

Day 104: Creating A Ledge Grab In Unity Part 2

Galaxy Shooter: Powerups and Inheritance

Using Multiple Post Processing Profiles and Reflection Probes for my spooky office scene.

Learn to make cutscenes in unity3d by building a stealth Game.