Topic locked

I am getting error as "VirtualButtonBehaviour' does not contain a definition for 'RegisterOnButtonPressed* "

September 10, 2021 - 6:20am #1

I am writing a script for action due to Virtual button as below, but i am getting following error "VirtualButtonBehaviour' does not contain a definition for 'RegisterOnButtonPressed* and no accessible CS1061 extension method 'RegisterOnButtonPressed* accepting a first argument of type VirtualButtonBehaviour' Assembly-CSharp could be found (are you missing a using directive or an assembly reference?".

I have seen all articles and queries but i am not able to solve it. Please help

 

using UnityEngine;

using System.Collections;

using System.Collections.Generic;

using Vuforia;

using UnityEngine.Networking;

public class ButtonScript : MonoBehaviour

{

    public VirtualButtonBehaviour VirtualButton_ON;

    public VirtualButtonBehaviour VirtualButton_OFF;

    public string url_on;

    public string url_off;

    IEnumerator GetRequest(string uri)

    {

        using (UnityWebRequest webRequest = UnityWebRequest.Get(uri))

        {

            // Request and wait for the desired page.

            yield return webRequest.SendWebRequest();

        }

    }

    // Start is called before the first frame update

    //Note: Handle the events with OnButtonPressed and OnButtonReleased when the button is visually obstructed from the camera.

    void Start()

    {

        //Assigning a function when a 'ON' button is pressed

        VirtualButton_ON.RegisterOnButtonPressed(OnButtonPressed_on);

        //Assigning a function when a 'OFF' button is pressed

        VirtualButton_OFF.RegisterOnButtonPressed(OnButtonPressed_off);

    }



    public void OnButtonPressed_on(VirtualButtonBehaviour VirtualButton_ON)

    {

        StartCoroutine(GetRequest(url_on));

        Debug.Log("LED IS ON");

    }

    public void OnButtonPressed_off(VirtualButtonBehaviour VirtualButton_OFF)

    {

        StartCoroutine(GetRequest(url_off));

        Debug.Log("LED IS OFF");

    }

}

AttachmentSize
Image icon doubt.PNG9.32 KB

I am getting error as "VirtualButtonBehaviour' does not contain a definition for 'RegisterOnButtonPressed* "

September 14, 2021 - 3:46am #2

Hey there,

 

Which version of Vuforia Engine are you using?

 

Kind regards,

Patrick Scheper

Technical Community Manager

Topic locked