I'm trying to intercept the GoogleVR close button press so I can switch back to Mono. I've created the class below to attempt to catch the BackButtonPressed flag. However it doesn't appear to ever change before the entire app is shutdown. Is BackButtonPressed the correct way to catch the press of this button?
GVR SDK: GoogleVR 1.3.0
Unity: Unity 5.6f3
Phone: Google Nexus 5X, OS 7.1.2
public class VideoPlayerControls : MonoBehaviour
* Handle Cardboard back button press
void Update ()
print("BACK BUTTON PRESSED"); //This never gets displayed in Android logs
// Handle Switch to Mono - This will call VRSettings.LoadDeviceByName("None");
playlist.videos .cardboardMode = !playlist.videos .cardboardMode;
player = PlayerFactory.Init (playlist, aControlType);
player.SetUrl (playlist.videos .url);
Answer by Spidlee
3 days ago
GvrViewer.Instance.BackButtonPressed, is indeed the way to check if [X] is pressed.
Have you tried the below to toggle VR on/off?
GvrViewer.Instance.VRModeEnabled = !GvrViewer.Instance.VRModeEnabled;
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
7 People are following this question.
Change the position of a UI component through pressing a UI Button
Get UI Button dimensions in game via script C#
Change button opacity using C# script?
Click a UI button from a script
Strange UI Button hover offset when using Worldspace Canvas in VR