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, etc.

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

Recommended from Medium

What is extreme programming and how it makes your code better?

Who is Ada?

Solve (and understand!) the Project Euler Problems in Python — Introduction and Problems 1–3

Use NVIDIA DeepStream to Accelerate H.264 Video Stream Decoding

How to extract Files and Folders from a Zip Archive in C# .NET Framework

Deploying Helidon applications to Azure App Service

CA JCLCheck and Zowe ensure that JCL runs successfully at your site

Object-Oriented Programming

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, etc.

More from Medium

Using Layered Lit to mix Texture Maps

How To Use Post Processing In Unity

Coroutines with Unity

Space Craft Effects