- Home /
Scene changing with virtual button
Hi everyone....my problem is I am unable to change the scene with virtual button. Here is the script which I have attached with the virtual button. Can anyone help me out?
using System.Collections; using System.Collections.Generic; using UnityEngine; using Vuforia; using UnityEngine.SceneManagement;
public class vbButton_cube : MonoBehaviour, IVirtualButtonEventHandler { public GameObject[] myButtons; public GameObject cube;
public GameObject VirtualButton;
// Start is called before the first frame update
void Start()
{
/ for (int i = 0; i < myButtons.Length; i++) { myButtons[i].GetComponent().RegisterEventHandler(this); } / }
// Update is called once per frame
void Update()
{
}
public void OnButtonPressed(VirtualButtonBehaviour vb)
{
Debug.Log(vb.name);
//cube.SetActive(true);
SceneManager.LoadScene("MAIN COURSE");
}
public void OnButtonReleased(VirtualButtonBehaviour vb)
{
cube.SetActive(true);
}
},Hi everyone...I am unable to change the scene by using the virtual button. Here is the script Which I have attached with the virtual button. Can anyone help me out?
using System.Collections; using System.Collections.Generic; using UnityEngine; using Vuforia; using UnityEngine.SceneManagement;
public class vbButton_cube : MonoBehaviour, IVirtualButtonEventHandler { public GameObject[] myButtons; public GameObject cube;
public GameObject VirtualButton;
// Start is called before the first frame update
void Start()
{
/ for (int i = 0; i < myButtons.Length; i++) { myButtons[i].GetComponent().RegisterEventHandler(this); } / }
// Update is called once per frame
void Update()
{
}
public void OnButtonPressed(VirtualButtonBehaviour vb)
{
Debug.Log(vb.name);
//cube.SetActive(true);
SceneManager.LoadScene("MAIN COURSE");
}
public void OnButtonReleased(VirtualButtonBehaviour vb)
{
cube.SetActive(true);
}
}