Log in or register to post comments

error CS0029: Cannot implicitly convert type `Vuforia.VirtualButtonBehaviour' to `Vuforia.VirtualButtonBehaviour[]'

October 11, 2016 - 11:53am #1

i would like to make my object appear when i pressed the virtual button

but i got this error 

Assets/Scripts/vbScript.cs(12,42): error CS0029: Cannot implicitly convert type `Vuforia.VirtualButtonBehaviour' to `Vuforia.VirtualButtonBehaviour[]'

i already search the entire forum but i cant find any clue, please help

i use this method as reference http://www.marcofolio.net/other/virtual_buttons_in_augmented_reality_with_vuforia.html

and this is my code:

using UnityEngine;
using System.Collections;
using Vuforia;

public class vbScript : MonoBehaviour, IVirtualButtonEventHandler
{
private GameObject Gwk_Obj;

void Start ()

{
  VirtualButtonBehaviour[] vbs = GetComponentInChildren<VirtualButtonBehaviour>();
  for (int i = 0; i < vbs.Length; ++i)
  {
   vbs[i].RegisterEventHandler(this);
  }

  Gwk_Obj = transform.FindChild("Gwk_Model").gameObject;

  Gwk_Obj.SetActive(false);

}

public void OnButtonPressed(VirtualButtonAbstractBehaviour vb)
{
  switch (vb.VirtualButtonName)
  {
  case "Gwk_Button":
   Gwk_Obj.active = true;
   break;
  }
}

public void OnButtonReleased(VirtualButtonAbstractBehaviour vb)
{

}
}

error CS0029: Cannot implicitly convert type `Vuforia.VirtualButtonBehaviour' to `Vuforia.VirtualButtonBehaviour[]'

January 4, 2017 - 1:31am #2

I also found the same thing, but then I realized I just miss one "S" in here -> GetComponentsInChildren<VirtualButtonBehaviour>()

 

Log in or register to post comments