change scene on click of a 3d object

Hi All,

I’m using unity 5.3, I’m trying to change scene on click of a 3d object (cube) ( not a GUI Button).

I’m using this Javascript:

#pragma strict

function Start () {

}

 function Update () {
         if(Input.GetMouseButton(0))
             SceneManager.LoadScene("number2");
     }

Without success, I’m having this error: BCE0005: Unknown identifier: ‘SceneManager’.

I tried different code, and can’t make this work . . . Any help would be amazing !

Thank you for your time

This will change scene all time when you click left mouse button. But you need change scene when clicking on Cube. Try this

EDIT: Create new C# script named SceneChange.cs

 using UnityEngine;
 using System.Collections;
 using UnityEngine.SceneManagement;
 
 public class SceneChange : MonoBehaviour {
 
     Ray ray;
     RaycastHit hit;
 
     void Update()
     {
         ray = Camera.main.ScreenPointToRay(Input.mousePosition);
         if (Physics.Raycast(ray, out hit) && Input.GetMouseButton(0))
         {
             if (hit.collider.name == "cubone") 
             {
                 SceneManager.LoadScene("scena2stanza");
             }
         }
     }
 }

It doesn’t work. I would like to say i work with gear vr and the name of my ray script is raycaster. i found it here: http://www.samsung.com/us/samsungdeveloperconnection/developer-resources/gear-vr/apps-and-games/exercise-1-creating-a-unity-project.html. I put raycaster and reticle into a camera.
[68424-cattura.png|68424]