This repository has been archived by the owner on Nov 8, 2019. It is now read-only.
GVR SDK for Unity v1.150.0
Multiple controller support
- New
GvrControllerInputDevice
class for accessing controllers, accessible viaGvrControllerInput.GetDevice(GvrControllerHand hand)
. - New
GvrControllerInput.OnDevicesChanged
event to handle changes inGvrControllerInputDevice
instances. Old instances will be marked invalid and error when used. When this event fires, re-fetch the desiredGvrControllerInputDevice
fromGvrControllerInput.GetDevice()
. New handlers added to this event will be called immediately upon adding. - New
GvrControllerHand
enum for specifying handedness.- Values:
Right
,Left
,Dominant
,NonDominant
. Dominant
controller will always be present on single and multiple controller systems and will map to theRight
orLeft
controller depending on the handedness system prefrerence setting (GvrSettings.Handedness
).
- Values:
- New
GvrControllerButton
enum for specifying controller buttons. Values can be OR'ed together to create a multi-button mask. - New
GvrTrackedController.ControllerHand
property to specify which handGvrTrackedController
tracks. - New
IGvrControllerInputDeviceReceiver
interface. Script components that that implement this receiver interface and are children ofGvrTrackedController
or children of the object set inGvrTrackedController.ArmModel
will receive callbacks when the tracked controller initializes or changes its device instance. - GvrControllerPointer prefab defaults to
Dominant
controller.- The prefab will automatically track the Daydream controller on devices that only support one controller.
- To develop for devices that support two controllers, add a second prefab instance to your scene and change the hand property to
NonDominant
.
- HelloVR scene now has two
GvrControllerPointer
game objects forDominant
andNonDominant
hands.- On devices that only support a single controller, only the
Dominant
controller will be activated at runtime.
- On devices that only support a single controller, only the
- DemoSceneManager prefab updated for 2 controllers.
DemoInputManager
'sControllerPointers
property is now an array to handle multiple controllers. Since there can only be one pointer at a time,DemoInputManager
activates the single pointer on the last controller the user clicked theApp
orTouchPadButton
button.- Generally, when upgrading from obsolete
GvrControllerInput
methods toGvrControllerInputDevice
methods, you will need to consider how best to getGvrControllerInputDevice
instance updates. If your component will be a child ofGvrTrackedController
, then your component should implement theIGvrControllerInputDeviceReceiver
interface to receive device instance updates fromGvrTrackedController
. This has the advantage that your component will automatically get theGvrControllerInputDevice
of the hand for which the parentGvrTrackedController
is configured. If your component lives outside ofGvrTrackedController
you can either fetch a device instance every time you need one fromGvrControllerInput.GetDevice()
, or register an event hander forGvrControllerInput.OnDevicesChanged
to receive callbacks when device instances change and cache the result of a call toGvrControllerInput.GetDevice()
.
Breaking changes
None.
Deprecations
- Most of the static
GvrControllerInput
methods and properties have been deprecated. Replacement methods and properties can be accessed on the newGvrControllerInputDevice
instances:- The following static properties are available, with the same name, as
GvrControllerInputDevice
instance properties:OnStateChanged
State
Orientation
Gyro
Accel
ErrorDetails
StatePtr
IsCharging
BatteryLevel
- The following static properties have been deprecated and are replaced by a single
TouchPos
instance property onGvrControllerInputDevice
that returns center relative touch coordinates:GvrControllerInput.TouchPosCentered
(center is(0, 0)
) ->TouchPos
(center is(0, 0)
)GvrControllerInput.TouchPos
(top-left is(0, 0)
) ->TouchPos
onGvrControllerInputDevice
(center is(0, 0)
)
- The following static methods have been replaced by similarly named
GvrControllerInputDevice
instance methods. Method names have been changed for consistency with Unity's Input API:GvrControllerInput.IsTouching()
->GetButton(GvrControllerButton.TouchPadTouch)
GvrControllerInput.TouchDown()
->GetButtonDown(GvrControllerButton.TouchPadTouch)
GvrControllerInput.TouchUp()
->GetButtonUp(GvrControllerButton.TouchPadTouch)
GvrControllerInput.ClickButton()
->GetButton(GvrControllerButton.TouchPadButton)
GvrControllerInput.ClickButtonDown()
->GetButtonDown(GvrControllerButton.TouchPadButton)
GvrControllerInput.ClickButtonUp()
->GetButtonUp(GvrControllerButton.TouchPadButton)
GvrControllerInput.AppButton()
->GetButton(GvrControllerButton.App)
GvrControllerInput.AppButtonDown()
->GetButtonDown(GvrControllerButton.App)
GvrControllerInput.AppButton()
->GetButtonUp(GvrControllerButton.App)
GvrControllerInput.HomeButtonDown()
->GetButtonDown(GvrControllerButton.System)
GvrControllerInput.HomeButtonState()
->GetButton(GvrControllerButton.System)
- The following static properties are available, with the same name, as
Behavioral changes
HeadsetDemoManager
debug logging of safety region and floor height is now off by default.
Other changes
- Added support for positionally tracked headsets in Instant Preview.
- Updated bundled lib GVR for Android to v1.150.0.
- Fixed IPreprocessBuild and IPostrocessBuild obsolete warnings in Unity 2018.x.
- Added null checks on
safetyRing
inHeadsetDemoManager
. - Added source code for native libs
gvr-exoplayersupport
,gvr-keyboardsupport
,gvr-permissionsupport
, andvideo_plugin
to the git repo. Addresses issues 437 and 556.
Experimental features
Bug fixes
- Fixed issue 822 where the permission request could result in a crash after the permission had been granted.
- Fixed issue 835. The
GvrEditorEmulator
was previously allocating memory every frame, and should now only allocate onAwake()
. - Fixed issue 865 where
GvrVRHelpers.GetHeadRotation()
didn't work with Instant Preview. - Fixed issue 888. Added a console warning when trying to use a
GvrTrackedController
without aGvrControllerInput
. - Fixed issue 917 where using
GVRKeyboard
when building with IL2CPP would throwNotSupportedException
. - Fixed issue 918 where adding a new
GVRKeyboard
component after destroying one will cause a crash. - Fixed the pointer reticle not showing up properly on all of the demo scenes that use the CubeRoom prefab.
- Fixed missing Instant Preview newlines characters in standard output and standard error console messages.