I am trying to transform object into VR app using google cardboard sdk in Unity3d. I write a script and comparing input buttons on Update method. So my code is below.
void Update () {
if (Input.GetButtonDown("Fire1"))
{
onObjectDown();
}
if (Input.GetButtonDown("Fire2"))
{
onObjectExit();
}
if (Input.GetButtonDown("Fire3"))
{
onObjectExit();
}
if (dragging)
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
Vector3 rayPoint = ray.GetPoint(distance);
transform.position = rayPoint;
}
}
onObjectDown() & onObjectExit() method are as follows
public void onObjectDown()
{
Debug.Log(name + " Game Object Down!");
distance = Vector3.Distance(transform.position, Camera.main.transform.position);
dragging = true;
}
public void onObjectExit()
{
dragging = false;
Debug.Log(name + " Game Object Exit!");
GetComponent<Renderer>().material.color = originalColor;
}
This coding is perfectly working on play mode on desktop. But on emulator only onObjectDown is executing. This means only "Fire1" button is pressed. Is anyone know how to get input from button "Fire2" & "Fire3" via bluetooth controller ?
For reference, my input setting in project is as below