I am attempting to create an input field in a google daydream app using the latest Google VR SDK for Unity and Unity 5.4.2.
I am wondering if someone may have insight into integrating the Daydream Keyboard. I can place a canvas and input field but when I run the application on the Pixel and Daydream View, and select the inputfield the standard android keyboard renders.
I am not sure if the Daydream Keyboard needs to be integrated separately in unity.
The Daydream keyboard is installed and is functional on published daydream apps.
Nope, the official Daydream Keyboard is not Unity ready, see https://forum.unity3d.com/threads/daydream-keyboard-in-unity.441448/
You can download the GoogleVR SDK, and you will find the keyboard demo scene inside GoogleVR/Demos/Scenes. From there, you can use the prefabs given for keyboard.
Apart from this, you can use the free asset "CurvedKeyboard" from asset store.
To handle the android default keyboard, you can do something like this.
public class SomeClass:MonoBehaviour
{
private TouchScreenKeyboard defaultKeyboard;
void Start ()
{
defaultKeyboard = TouchScreenKeyboard.Open ("", TouchScreenKeyboardType.Default);
defaultKeyboard.active = false;
}
public void didClickOnTextField()
{
defaultKeyboard.active = false;
}
}
Related
I am building an AR project using Unity and Meta 2 glasses. I am using Vuforia to detect an object when I add the vuforia packages to the project and run it I see like a video in the background. It is so distracting and could not manage to disable it.
See a screenshot
Any clue how to disable it?
Unless the Vuforia version you have recognizes your specific AR device, Vuforia thinks it is a phone and renders the video background. All you have to do is not to render the video background.
Here you can find the exact instructions of how to disable the rendering of the background in Unity:
Disabling video background
The important code is this:
BackgroundPlaneBehaviour bgPlane = GetComponent<BackgroundPlaneBehaviour> ();
if (bgPlane.enabled) {
bgPlane.enabled = false;
}
While in Cardboard VR-Mode you can use a cogwheel icon in the top-right-corner.
This button access the VR Settings.
I want to access it directly inside of Unity3D.
I cant find any api making that available or mention it.
please help :)
Answer:
Assuming you mean either the settings button or the Cardboard back button, it seems you can customize the one via listening for KeyCode.Escape, but that the other one is fixed.
Source:
You can customize the behaviour of the Cardboard back button by listening for Input.GetKeyDown(KeyCode.Escape)), but the Settings button is not override-able.
https://forum.unity.com/threads/accessing-cardboard-back-and-configure-buttons.461975/
I am working on Unity 5.6.5f1 with VR enabled and Daydream selected for an Android app. So my application is working with daydream but I would like to get inputs from the Daydream remote (only a simple click). Is that possible without including the GVR sdk to my project?
Alternatively, can I catch a click on the on/off button or the sound level button of the phone in my app?
You need to import the GVR unity package so that you can access the GVRController class. Only then can you get the on click event.
I finally managed to catch clicks on the volume up and down buttons of the daydream remote control thanks to this post. Quite an ugly solution but it does the trick and provides two inputs.
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.
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
I was wondering if there is a way to show Google VR black border on stereo view inside the Unity Editor. Currently, it seems to be automatically created when compiled for mobile devices. But no way to have it in Editor or even in Desktop Application.
The latest version of the Cardboard SDK for Unity (v0.4.9) will do this.