How to detect Cardboard button down in Cardboard Unity SDK (Unity 5.6)

google-cardboard, unity-game-engine

Solution

Since I couldn't get the Google VR way of detecting the button press working (which is `GvrViewer.Instance.Triggered`) I ended up using touch events provided by Unity on touch devices.

Right now my condition looks like following

Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began

Problem

I'm trying to detect cardboard button click with Cardboard Unity SDK. I'm using this ``` Google VR SDK for Unity v1.40 (April 2017), right now it's the latest ``` I'm using Unity `5.6.0f3`, this also seems to be latest currently. I'm not able to detect the button click using ``` GvrViewer.Instance.Triggered ``` Unity UI events are working as expected (Buttons and all), however I need to perform some action without using UI, like jumping on click of the button in the cardboard. In the latest release Google VR SDK says that it has removed support for the magnetic button. However I'm not using the magnetic button. Mine has button which works with touch screen. (Version released after Google IO 2015) This is the cardboard that I'm using I just can't figure out how to detect the normal button press. Any information is appreciated. *Edit * Following is the line from GvrViewer where `Triggered` is populated. ``` private void DispatchEvents() { // Update flags first by copying from device and other inputs. Triggered = Input.GetMouseButtonDown(0); #if UNITY_HAS_GOOGLEVR && (UNITY_ANDROID || UNITY_EDITOR) Triggered |= GvrController.ClickButtonDown; #endif // UNITY_HAS_GOOGLEVR && (UNITY_ANDROID || UNITY_EDITOR) ``` I have checked it in various combinations on the phone it doesn't work.

Original source