// Update is called once per frame public void OnButtonPressed(VirtualButtonBehaviour vb) { if (vb.VirtualButtonName == "RBI") { UnityEngine.Debug.Log("RBI Pressed"); RBI.SetActive(true); MKG.SetActive(false); Satya.SetActive(false); } else if (vb.VirtualButtonName == "MKG") { RBI.SetActive(false); MKG.SetActive(true); Satya.SetActive(false); } else if (vb.VirtualButtonName == "Satya") { RBI.SetActive(false); MKG.SetActive(false); Satya.SetActive(true); } else { throw new UnityException(vb.VirtualButtonName + "Virtual Button not supported"); } }
void Start() { VirtualButtonBehaviour[] vrb = GetComponentsInChildren <VirtualButtonBehaviour>(); for (int i = 0; i < vrb.Length; i++) { vrb[i].RegisterEventHandler(this); //vrb[i].RegisterOnButtonReleased(OnButtonReleased); } RBI.SetActive(false); MKG.SetActive(false); Satya.SetActive(false); }