I created a virtual button so I can control a cube to have it disappear and appear. In this case i can make the cube disappear but it will not appear again.
using UnityEngine;
using System.Collections;
using Vuforia;
public class AnotherVirtualButtonScript : MonoBehaviour, IVirtualButtonEventHandler
{
// Use this for initialization
void Start()
{
GameObject virtualButtonObject = GameObject.Find("cubeButton");
virtualButtonObject.GetComponent<VirtualButtonBehaviour>().RegisterEventHandler(this);
VirtualButtonBehaviour[] vbs = GetComponentsInChildren<VirtualButtonBehaviour>();
for (int i = 0; i < vbs.Length; ++i)
{
vbs*.RegisterEventHandler(this);*
}
}
public void OnButtonPressed(VirtualButtonBehaviour vb)
{
GameObject.Find(“Cube”).SetActive(false);
}
public void OnButtonReleased(VirtualButtonBehaviour vb)
{
GameObject.Find(“Cube”).SetActive(true);
}
// Update is called once per frame
void Update()
{
}
}
I’m not sure if its my code but how can I get this to work?