When i add virtual buttons to my project I write a script for it, assign the script to the ImageTarget, Test it and nothing happens when i hover my finger over the Virtual Button it does nothing at all.
Heres my script:
using UnityEngine;
using System.Collections;
public class VirtualButtonEventHandler : MonoBehaviour, IVirtualButtonEventHandler {
char x;
char a = 'a';
public GameObject Keyboard;
public GameObject Text;
// Use this for initialization
void Start () {
Keyboard = transform.FindChild("Text").gameObject;
}
public void OnButtonPressed(VirtualButtonBehaviour vb){
Debug.Log ("Pressed");
GetComponent<TextMesh>().text = "test";
}
public void OnButtonReleased(VirtualButtonBehaviour vb){
Debug.Log("Released");
}
void Update () {
}
}
Please tell me the problem or give me a tutorial because there are no tutorials on the Qualcomm website that tell you how to do it.
On the website it doesn't tell you how to do something when the button is pressed
– jason7262Only you know what you want your buttons to do, so the Vuforia pages won't help there. Once you know what you want your buttons to do, you put the implementation inside the OnButtonPressed -function. You get the Vuforia AR system to call your OnButtonPressed function by subscribing to the Event handler in the ImageTargetBehavior script. It's all in the links I posted.
– JamoraOk so EXACTLY WHERE DO WE PUT THIS???? Does it go inside the event handler or prior to it? does it go in the declarations? Total noob here... i know common sense says prior... but NOTHING tells you WHERE to... so frustrating. Some one please provide the complete code
– PaulzCreative