GvrPointerInputModule
This script provides an implemention of Unity's BaseInputModule class. 
Summary
Exists so that Canvas-based (uGUI) UI elements and 3D scene objects can be interacted with in a Gvr Application. 
This script is intended for use with either a 3D Pointer with the Daydream Controller (Recommended for Daydream), or a Gaze-based-Pointer (Recommended for Cardboard).
To use, attach to the scene's EventSystem object. Be sure to move it above the other modules, such as TouchInputModule and StandaloneInputModule, in order for the Pointer to take priority in the event system. 
If you are using a Canvas, set the Render Mode to World Space, and add the GvrPointerGraphicRaycaster script to the object. 
If you'd like pointers to work with 3D scene objects, add a GvrPointerPhysicsRaycaster to the main camera, and add a component that implements one of the Event interfaces (EventTrigger will work nicely) to an object with a collider. 
GvrPointerInputModule emits the following events: Enter, Exit, Down, Up, Click, Select, Deselect, UpdateSelected, and GvrPointerHover. Scroll, move, and submit/cancel events are not emitted. 
To use a 3D Pointer with the Daydream Controller:
- Add the prefab GoogleVR/Prefabs/UI/GvrControllerPointer to your scene.
- Set the parent of GvrControllerPointerto the same parent as the main camera (With a local position of 0,0,0).
To use a Gaze-based-pointer:
- Add the prefab GoogleVR/Prefabs/UI/GvrReticlePointer to your scene.
- Set the parent of GvrReticlePointerto the main camera.
Inheritance
Inherits from: BaseInputModule, IGvrInputModuleController| Public attributes | |
|---|---|
| scrollInput = new GvrPointerScrollInput() | Manages scroll events for the input module. | 
| vrModeOnly = false | boolIf  true, pointer input is active in VR Mode only. | 
| Properties | |
|---|---|
| CurrentRaycastResult | static RaycastResultGets the current  RaycastResult. | 
| EventExecutor | Gets the executor this module uses to process events.  | 
| Impl | Gets the implementation object of this module.  | 
| Pointer | static GvrBasePointerGets or sets the static reference to the  GvrBasePointer. | 
| RaycastResultCache | List< RaycastResult >Gets the list of raycast results used as a cache.  | 
| eventSystem | new EventSystemGets the event system reference.  | 
| Public static functions | |
|---|---|
| FindEventExecutor() | Helper function to find the Event executor that is part of the input module if one exists in the scene.  | 
| FindInputModule() | Helper function to find the input module if one exists in the scene and it is the active module.  | 
| OnPointerCreated(GvrBasePointer createdPointer) | voidThe  GvrBasePointercalls this when it is created. | 
| Public functions | |
|---|---|
| Deactivate() | voidDeactivate this instance. | 
| DeactivateModule() | override void | 
| FindCommonRoot(GameObject g1, GameObject g2) | new GameObjectFinds the common root between two  GameObjects. | 
| FindFirstRaycast(List< RaycastResult > candidates) | new RaycastResultFinds the first raycast.  | 
| GetBaseEventData() | new BaseEventDataGets the base event data.  | 
| IsPointerOverGameObject(int pointerId) | override bool | 
| Process() | override void | 
| ShouldActivate() | boolWhether the module should be activated.  | 
| ShouldActivateModule() | override bool | 
Public attributes
scrollInput
GvrPointerScrollInput scrollInput = new GvrPointerScrollInput()
Manages scroll events for the input module.
vrModeOnly
bool vrModeOnly = false
If true, pointer input is active in VR Mode only. 
If false, pointer input is active all of the time. 
Set to false if you plan to use direct screen taps or other input when not in VR Mode.
Properties
CurrentRaycastResult
static RaycastResult CurrentRaycastResult
Gets the current RaycastResult. 
The current RaycastResult.
EventExecutor
GvrEventExecutor EventExecutor
Gets the executor this module uses to process events.
The executor this module uses to process events.
Impl
GvrPointerInputModuleImpl Impl
Gets the implementation object of this module.
The implementation object of this module.
Pointer
static GvrBasePointer Pointer
Gets or sets the static reference to the GvrBasePointer. 
The static reference to the GvrBasePointer.
RaycastResultCache
List< RaycastResult > RaycastResultCache
Gets the list of raycast results used as a cache.
The list of raycast results used as a cache.
eventSystem
new EventSystem eventSystem
Gets the event system reference.
The event system reference.
Public static functions
FindEventExecutor
GvrEventExecutor FindEventExecutor()
Helper function to find the Event executor that is part of the input module if one exists in the scene.
| Details | |
|---|---|
| Returns | A found GvrEventExecutor or null. | 
FindInputModule
GvrPointerInputModule FindInputModule()
Helper function to find the input module if one exists in the scene and it is the active module.
| Details | |
|---|---|
| Returns | A found  GvrPointerInputModuleor null. | 
OnPointerCreated
void OnPointerCreated( GvrBasePointer createdPointer )
The GvrBasePointer calls this when it is created. 
If a pointer hasn't already been assigned, it will assign the newly created one by default. This simplifies the common case of having only one GvrBasePointer so it can be automatically hooked up to the manager. If multiple GvrBasePointers are in the scene, the app has to take responsibility for setting which one is active. 
| Details | |||
|---|---|---|---|
| Parameters | 
 | 
Public functions
Deactivate
void Deactivate()
Deactivate this instance.
DeactivateModule
override void DeactivateModule()
FindCommonRoot
new GameObject FindCommonRoot( GameObject g1, GameObject g2 )
Finds the common root between two GameObjects. 
| Details | |||||
|---|---|---|---|---|---|
| Parameters | 
 | ||||
| Returns | The common root. | 
FindFirstRaycast
new RaycastResult FindFirstRaycast( List< RaycastResult > candidates )
Finds the first raycast.
| Details | |||
|---|---|---|---|
| Parameters | 
 | ||
| Returns | The first raycast. | 
GetBaseEventData
new BaseEventData GetBaseEventData()
Gets the base event data.
| Details | |
|---|---|
| Returns | The base event data. | 
IsPointerOverGameObject
override bool IsPointerOverGameObject( int pointerId )
Process
override void Process()
ShouldActivate
bool ShouldActivate()
Whether the module should be activated.
| Details | |
|---|---|
| Returns | Returns  trueif this module should be activated,falseotherwise. | 
ShouldActivateModule
override bool ShouldActivateModule()