button that change scene on click

Hi im a noob at scripting and i need a script or something that make that when we click on a button it change the scene i tried a lot of script that i found on the forum but none of them work for me so i someone could help me i will be grateful
PS : Sorry for my bad english it’s not my native language

do something like this:

using UnityEngine.SceneManager;


void OnMouseUp()
    SceneManager.LoadScene("SceneName", LoadSceneMode.single);

You will also want to go into build settings and add all scenes into the list. Then you will need to add a 2d collider to your button. This is only the loading scene parts but you can do other things like changing the button size OnMouseDown.

Here is a video tutorial to change scene using button, i think is clear cause most of the step is zoom, so you can read it easily.

video-change scene using button

  1. add this script to the main camera

  2. create a button

  3. from the inspector of UIbutton, over the onclick() function, add camera as object, then choose function call menuscript, then select change scene function.

  4. open new scene

  5. add scene to the platform

  6. done.

    using Unityengine;
    using System.Collections;

    public class MenuScript : MonoBehaviour
    public void ChangeScene(string sceneName)

On you’re script just add:

public void OnMouseClick(){
Application.LoadLevel(“Here put the name of the scene”);

Then select the button and scroll down until you find Button script. At the bottom of the component there should be a “On click ()”.

Then put the script bellow the “On click()” then next to it there it should say No Function. Click on that and find you’re script’s name and select OnMouseClick() option.

Here is a video I made of How To Change Scenes with the latest unity build, 2017. It’s part of a VR series but should work just fine for any project!

using UnityEngine.UI;

public string sceneName;
public Button loadSceneBtn;

void Start(){

void ChangeScene(){

Here: Using a Unity button to switch between scenes.