API reference
API reference
Select your platform
No SDKs available
No versions available

OVRControllerTest Class

Extends MonoBehaviour
Helper/diagnostic class which reads controller state and serializes it to a Unity Text asset on a per-frame basis.
Rather than being bound to a specific controller, instances of this class invoke OVRInput.GetActiveController each frame to report information on whichever controller is currently considered active. Consequently, there is no reason to ever have more than one OVRControllerTest active at the same time.

Fields

uiText : Text
The Unity Text object in which to display the results of the various tests this instance monitors.
BoolMonitor reflecting input state as well as specific controller information (battery percentage, position/orientation, etc.) are serialized to this text on a per-frame basis.
Signature
Text uiText

Inner Class

BoolMonitor Class

Simple helper class used to observe a simple closure and report its behavior over time.
BoolMonitor is used by OVRControllerTest to conveniently serialize controller behavior into a human-readable format. For example, a test of OVRInput.Button.One will observe OVRInput.Get(OVRInput.Button, OVRInput.Controller) with that input, displaying the monitor's name and current state in the format, "One: *True*," etc.

Constructors

BoolMonitor ( name , generator , displayTimeout )
Constructor for BoolMonitor.
Signature
BoolMonitor(string name, BoolGenerator generator, float displayTimeout=0.5f)
Parameters
name: string  The display name of the closure being monitored
generator: BoolGenerator  The closure to be monitored
displayTimeout: float  Optional parameter controlling how long after changing the display text for this monitor will remain emphasized

Methods

AppendToStringBuilder ( sb )
Serializes the current state of the monitor into a StringBuilder to be displayed.
This is a non-modifying function and does not actually update the current state; to update state, a separate call to Update must be made.
Signature
void AppendToStringBuilder(ref StringBuilder sb)
Parameters
sb: ref StringBuilder  The string builder to which the serialization should be appended
Returns
void
BoolGenerator ()
The closure type observed by by this BoolMonitor over time.
BoolMonitor(string, BoolGenerator, float) is typically invoked with an anonymous function as its second argument, which will be interpreted as this type.
Signature
delegate bool BoolGenerator()
Returns
delegate bool
Update ()
Updates the BoolMonitor's state.
This invokes the BoolGenerator closure passed to this instance at construction, then updates the monitor's internal state based on whether and when the result of the closure changed.
Signature
void Update()
Returns
void