Search Unity

Trying to make a main menu thing to make different SCENES appear....

Discussion in 'Scripting' started by johnsondoarts, Feb 1, 2020.

  1. johnsondoarts

    johnsondoarts

    Joined:
    Jan 30, 2020
    Posts:
    1
    Please correct my script if possible..... I don't know where I went wrong.... I was following a youtube tutorial and now I'm stuck on not being able to drag the new script written into a Scene01Button button I made... Please help...

    upload_2020-2-1_3-32-23.png upload_2020-2-1_3-32-47.png upload_2020-2-1_3-32-34.png

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.SceneManagement;
    5.  
    6. public class SceneSelectScript: MonoBehaviour{
    7.  
    8.    public void selectScene() {
    9.         switch (this.gameObject.name) {
    10.             case "Scene01Button":
    11.                 SceneManager.LoadScene.("Scene01");
    12.                 break;
    13.             case "Scene02Button":
    14.                 SceneManager.LoadScene. ("Scene02");
    15.                 break;
    16.             case "Scene03Button":
    17.                 SceneManager.LoadScene. ("Scene03");
    18.                 break;
    19.         }
    20.     }
    21. }
    22.