"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 Error with Unity

Hi guys!

I am having problems programming a virtual button to make a zombie walk (augmented reality).

The code is:

----------------------------------------------------------------------------------------------------------------

using UnityEngine; using System.Collections; using Vuforia;

public class New : MonoBehaviour, IVirtualButtonEventHandler {     private GameObject vbButtonObject;     private GameObject zombie; // Use this for initialization void Start () {         vbButtonObject = GameObject.Find("actionButton");         zombie = GameObject.Find("zombie");         vbButtonObject.GetComponent<VirtualButtonBehaviour> ().RegisterEventHandler (this); } public void OnButtonPressed (VirtualButtonAbstractBehaviour vb){         Debug.Log("button down!!!!");         zombie.GetComponent<Animation> ().Play ();        }     public void OnButtonReleased (VirtualButtonAbstractBehaviour vb) {         zombie.GetComponent<Animation> ().Stop ();     } }

---------------------------------------------------------------------------------------------------------

The Error mensaje that appears when I touch the button is:

-----------------------------------------------------------------------------------------------------------------

NullReferenceException: Object reference not set to an instance of an object New.OnButtonPressed (Vuforia.VirtualButtonAbstractBehaviour vb) (at Assets/New.cs:16) Vuforia.VirtualButtonAbstractBehaviour.OnTrackerUpdated (Boolean pressed) Vuforia.StateManagerImpl.UpdateVirtualButtons (Int32 numVirtualButtons, IntPtr virtualButtonPtr) Vuforia.VuforiaManagerImpl.UpdateTrackers (FrameState frameState) Vuforia.VuforiaManagerImpl.Update (ScreenOrientation counterRotation, Boolean reapplyOldState) Vuforia.VuforiaAbstractBehaviour.UpdateStatePrivate (Boolean forceUpdate, Boolean reapplyOldState) Vuforia.VuforiaAbstractBehaviour.UpdateState (Boolean forceUpdate, Boolean reapplyOldState) Vuforia.DigitalEyewearAbstractBehaviour.Update ()

------------------------------------------------------------------------------------------------------------------------------

Please some help!