"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

Virtual Button problem

Hi i just recently started using Vuforia sdk and i have difficulties making virtual buttons ...i must say at the beggining that i tryed the sample app and well did not understand it ;/ 

here is what i did:i added virtual button to the scene as a child of image targer then added plane as a child of virtual button so i can see it . Then i have written simple script to manage button actions and added that script to image targer.

 

public class ManageButtons : MonoBehaviour, IVirtualButtonEventHandler {

    // Use this for initialization    
    void Start () {
        
        VirtualButtonBehaviour[] vbs = GetComponentsInChildren<VirtualButtonBehaviour>();

        foreach (VirtualButtonBehaviour item in vbs) {            
            item.RegisterEventHandler(this);            
        }        
    }

    // Update is called once per frame    
    void Update () {
    }

    public void OnButtonPressed(VirtualButtonAbstractBehaviour vb) {        
        Debug.Log("Helllllloooooooooo");        
    }
    
    public void OnButtonReleased(VirtualButtonAbstractBehaviour vb) {        
        Debug.Log("Goooooodbyeeee");        
    }
}

 

and it's not working ;/ can anyone indicate me to a solution 

Hey there,

I recently did some playing with Virtual Buttons myself. 

This is the script that I got working for my Next and Back buttons.

I'm not sure exactly what you mean by "visible".  But I believe the VirtualButtonPreviewMaterial (light blue by default) should be visible to your AR Camera. 

By not visible i mean that i can't see it when testing. It's visible in editor but when i test it with camera i cant see it. I'll try to tweak the settings and position maybe it will help

 

I cant't chande thy Y position of button

Well i can't figure out why it's not working. But it's not essensial for my project, just wanted to check out how it works

Virutal buttons are not visible by default in Play Mode. 

The reason you see an outline around the Virtual Buttons in the example is because there was code written to implement that. 

See the VirtualButtonsUIEventHandler.cs