"We offer new support options and therefor the forums are now in read-only mode! Please check out our Support Center for more information." - Vuforia Engine Team

Creating 2 Virtual Button in 1 scene

hi! I want to ask how to make 2 virtual buttons at once? I'm really confused about the "(variable name).GetComponent().RegisterOnButtonPressed(OnButtonPressed);" because I want to make 2 vb. this is my code, please correct me if something is wrong, pls help me, thank you.

 

public class VBManager : MonoBehaviour {

// private fields to store models private GameObject sc_brosur; private GameObject sc_video; private GameObject btn_1; private GameObject btn_2; // memanggil scene ketika loaded void Start() {      // mencari child dari object ini yang memiliki script VirtualButtonBehaviour      btn_1 = GameObject.Find("btn_info");      btn_2 = GameObject.Find("btn_video");     btn_1.GetComponent<VirtualButtonBehaviour>().RegisterOnButtonPressed(OnButtonPressed);     btn_1.GetComponent<VirtualButtonBehaviour>().RegisterOnButtonReleased(OnButtonReleased);     btn_2.GetComponent<VirtualButtonBehaviour>().RegisterOnButtonPressed(OnButtonPressed);     btn_2.GetComponent<VirtualButtonBehaviour>().RegisterOnButtonReleased(OnButtonReleased);      // setelah tracking camera model bisa muncul ketika ditekan      sc_brosur.SetActive(false);      sc_video.SetActive(false);      btn_1.SetActive(true); //vb brosur      btn_2.SetActive(true); //vb video      } /// <summary> // memanggil objek ketika virtual button ditekan (eksekusi) /// </summary> public void OnButtonPressed(VirtualButtonBehaviour vb) {      Debug.Log("Button pressed!");      switch(vb.VirtualButtonName) {          case "btn_info":          btn_1.SetActive(true);          btn_2.SetActive(true);          sc_video.SetActive(false);          sc_brosur.SetActive(true);                  break;          case "btn_video":          btn_1.SetActive(true);          btn_2.SetActive(false);          sc_video.SetActive(true);          sc_brosur.SetActive(false);                  break;      } } public void OnButtonReleased(VirtualButtonBehaviour vb) {      Debug.Log("Button released!"); } }