Hey sorry I am a Unity Newbie, but I am stuck. The buttons won’t switch to the scenes, the buttons work and the code shows no errors. Someone recommended looking at the build settings, all my scenes are selected, so I am really lost. Please Help!
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
using UnityEngine.EventSystems;
public class ChangeScene : MonoBehaviour {
// Use this for initialization
/*void Start () {
}
// Update is called once per frame
void Update () {
}*/
//detects which button is clicked
public void detectClick()
{
//get the name of the current clicked object
var theObject = EventSystem.current.currentSelectedGameObject;
//take action depending on which object is clicked
switch (theObject.name)
{
case "Microwave":
Debug.Log(theObject.name);
SceneManager.LoadScene("Coming_Soon");
break;
case "RiceCooker":
Debug.Log(theObject.name);
SceneManager.LoadScene("Coming_Soon");
break;
case "Stove":
Debug.Log(theObject.name);
SceneManager.LoadScene("Stove_Style");
break;
case "S_African":
Debug.Log(theObject.name);
SceneManager.LoadScene("Coming_Soon");
break;
case "S_Eastern":
Debug.Log(theObject.name);
SceneManager.LoadScene("Coming_Soon");
break;
case "S_MiddleEastern":
Debug.Log(theObject.name);
SceneManager.LoadScene("Coming_Soon");
break;
}
}
}