Stay organized with collections
Save and categorize content based on your preferences.
Google.XR.Cardboard.Api
CardboardXR Plugin API.
Summary
Public static functions
|
HasDeviceParams()
|
bool
Evaluates whether or not device params are saved in the storage.
|
HasNewDeviceParams()
|
bool
Evaluates if device parameters changed from last time they were reloaded.
|
Recenter()
|
void
Recenters the head tracker.
|
ReloadDeviceParams()
|
void
Enables device parameter reconfiguration on next frame update.
|
SaveDeviceParams(string uri)
|
void
Saves the encoded device parameters provided by an URI.
|
ScanDeviceParams()
|
void
Starts QR Code scanning activity.
|
UpdateScreenParams()
|
void
Updates screen parameters.
|
Properties
static bool IsCloseButtonPressed
Gets a value indicating whether the close button is pressed this frame.
static bool IsGearButtonPressed
Gets a value indicating whether the gear button is pressed this frame.
IsTriggerHeldPressed
static bool IsTriggerHeldPressed
Gets a value indicating whether Cardboard trigger button is held pressed.
IsTriggerPressed
static bool IsTriggerPressed
Gets a value indicating whether the Cardboard trigger button is pressed this frame.
MinTriggerHeldPressedTime
static double MinTriggerHeldPressedTime
Gets or sets the amount of time the trigger must be held active to be held pressed.
Public static functions
HasDeviceParams
bool HasDeviceParams()
Evaluates whether or not device params are saved in the storage.
Details |
Returns
|
Whether or not device parameters are found.
|
HasNewDeviceParams
bool HasNewDeviceParams()
Evaluates if device parameters changed from last time they were reloaded.
Details |
Returns
|
true when device parameters changed.
|
Recenter
void Recenter()
Recenters the head tracker.
ReloadDeviceParams
void ReloadDeviceParams()
Enables device parameter reconfiguration on next frame update.
SaveDeviceParams
void SaveDeviceParams(
string uri
)
Saves the encoded device parameters provided by an URI.
Expected URI format for:
Redirection is also supported up to a maximum of 5 possible redirects before reaching the proper pattern.
Only URIs using HTTPS protocol are supported.
Details |
Parameters |
uri
|
The URI string. See above for supported formats.
|
|
ScanDeviceParams
void ScanDeviceParams()
Starts QR Code scanning activity.
UpdateScreenParams
void UpdateScreenParams()
Updates screen parameters.
This method must be called at framerate to ensure the current screen orientation is properly taken into account by the head tracker.
All rights reserved. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-08-06 UTC.
[null,null,["Last updated 2024-08-06 UTC."],[[["\u003cp\u003eThe Google.XR.Cardboard.Api provides access to properties and functions for interacting with Cardboard XR devices in Unity.\u003c/p\u003e\n"],["\u003cp\u003eIt allows you to detect button presses (close, gear, and trigger), recenter the head tracker, and manage device parameters.\u003c/p\u003e\n"],["\u003cp\u003eDevice parameters can be loaded, saved, and scanned using QR codes to ensure proper device configuration.\u003c/p\u003e\n"],["\u003cp\u003eThe API includes functions for updating screen parameters and ensuring the head tracker is aware of screen orientation changes.\u003c/p\u003e\n"]]],[],null,["# Google.XR.Cardboard.Api Class Reference\n\nGoogle.XR.Cardboard.Api\n=======================\n\n[Cardboard](/cardboard/reference/unity/namespace/Google/XR/Cardboard#namespaceGoogle_1_1XR_1_1Cardboard)[XR](/cardboard/reference/unity/namespace/Google/XR#namespaceGoogle_1_1XR) Plugin API.\n\nSummary\n-------\n\n| ### Properties ||\n|--------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [IsCloseButtonPressed](#classGoogle_1_1XR_1_1Cardboard_1_1Api_1a17e68f98b1d88aa32b3c5515e11a5073) | `static bool` Gets a value indicating whether the close button is pressed this frame. |\n| [IsGearButtonPressed](#classGoogle_1_1XR_1_1Cardboard_1_1Api_1a82197b767efdcbbcd150671a20be7dea) | `static bool` Gets a value indicating whether the gear button is pressed this frame. |\n| [IsTriggerHeldPressed](#classGoogle_1_1XR_1_1Cardboard_1_1Api_1aca5c516036f0662d52a359df6a02c3a0) | `static bool` Gets a value indicating whether [Cardboard](/cardboard/reference/unity/namespace/Google/XR/Cardboard#namespaceGoogle_1_1XR_1_1Cardboard) trigger button is held pressed. |\n| [IsTriggerPressed](#classGoogle_1_1XR_1_1Cardboard_1_1Api_1a06d00b566fb762425245687c9c12c340) | `static bool` Gets a value indicating whether the [Cardboard](/cardboard/reference/unity/namespace/Google/XR/Cardboard#namespaceGoogle_1_1XR_1_1Cardboard) trigger button is pressed this frame. |\n| [MinTriggerHeldPressedTime](#classGoogle_1_1XR_1_1Cardboard_1_1Api_1a84100d4c904ef85c33c979ba9829a2aa) | `static double` Gets or sets the amount of time the trigger must be held active to be held pressed. |\n\n| ### Public static functions ||\n|-------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------|\n| [HasDeviceParams](#classGoogle_1_1XR_1_1Cardboard_1_1Api_1a54e37635f905505cb470741a1dc9498f)`()` | `bool` Evaluates whether or not device params are saved in the storage. |\n| [HasNewDeviceParams](#classGoogle_1_1XR_1_1Cardboard_1_1Api_1a9cf59d4acb253891b21b4b9f72dee5ec)`()` | `bool` Evaluates if device parameters changed from last time they were reloaded. |\n| [Recenter](#classGoogle_1_1XR_1_1Cardboard_1_1Api_1a089af663eb48a62a7028adb67950c899)`()` | `void` Recenters the head tracker. |\n| [ReloadDeviceParams](#classGoogle_1_1XR_1_1Cardboard_1_1Api_1ad284fe5e8201f9501319ae6a9f93bb1e)`()` | `void` Enables device parameter reconfiguration on next frame update. |\n| [SaveDeviceParams](#classGoogle_1_1XR_1_1Cardboard_1_1Api_1a32c0adae36fdf94621f29683ccf1692d)`(string uri)` | `void` Saves the encoded device parameters provided by an URI. |\n| [ScanDeviceParams](#classGoogle_1_1XR_1_1Cardboard_1_1Api_1a7e712232f1133a6cb7be8afba47bb5b6)`()` | `void` Starts QR Code scanning activity. |\n| [UpdateScreenParams](#classGoogle_1_1XR_1_1Cardboard_1_1Api_1ac6df7391252426a7f54f1d84cdc6f022)`()` | `void` Updates screen parameters. |\n\nProperties\n----------\n\n### IsCloseButtonPressed\n\n```c#\nstatic bool IsCloseButtonPressed\n``` \nGets a value indicating whether the close button is pressed this frame. \n\n### IsGearButtonPressed\n\n```c#\nstatic bool IsGearButtonPressed\n``` \nGets a value indicating whether the gear button is pressed this frame. \n\n### IsTriggerHeldPressed\n\n```c#\nstatic bool IsTriggerHeldPressed\n``` \nGets a value indicating whether [Cardboard](/cardboard/reference/unity/namespace/Google/XR/Cardboard#namespaceGoogle_1_1XR_1_1Cardboard) trigger button is held pressed. \n\n### IsTriggerPressed\n\n```c#\nstatic bool IsTriggerPressed\n``` \nGets a value indicating whether the [Cardboard](/cardboard/reference/unity/namespace/Google/XR/Cardboard#namespaceGoogle_1_1XR_1_1Cardboard) trigger button is pressed this frame. \n\n### MinTriggerHeldPressedTime\n\n```c#\nstatic double MinTriggerHeldPressedTime\n``` \nGets or sets the amount of time the trigger must be held active to be held pressed.\n\nPublic static functions\n-----------------------\n\n### HasDeviceParams\n\n```c#\nbool HasDeviceParams()\n``` \nEvaluates whether or not device params are saved in the storage.\n\n\u003cbr /\u003e\n\n| Details ||\n|-------------|---------------------------------------------|\n| **Returns** | Whether or not device parameters are found. |\n\n### HasNewDeviceParams\n\n```c#\nbool HasNewDeviceParams()\n``` \nEvaluates if device parameters changed from last time they were reloaded.\n\n\u003cbr /\u003e\n\n| Details ||\n|-------------|--------------------------------------|\n| **Returns** | true when device parameters changed. |\n\n### Recenter\n\n```c#\nvoid Recenter()\n``` \nRecenters the head tracker. \n\n### ReloadDeviceParams\n\n```c#\nvoid ReloadDeviceParams()\n``` \nEnables device parameter reconfiguration on next frame update. \n\n### SaveDeviceParams\n\n```c#\nvoid SaveDeviceParams(\n string uri\n)\n``` \nSaves the encoded device parameters provided by an URI.\n\nExpected URI format for:\n\n- [Cardboard](/cardboard/reference/unity/namespace/Google/XR/Cardboard#namespaceGoogle_1_1XR_1_1Cardboard) Viewer v1: \u003chttps://g.co/cardboard\u003e\n- [Cardboard](/cardboard/reference/unity/namespace/Google/XR/Cardboard#namespaceGoogle_1_1XR_1_1Cardboard) Viewer v2: \u003chttps://google.com/cardboard/cfd?p=deviceParams\u003e (for example, \u003chttps://google.com/cardboard/cfg?p=CgZHb29nbGUSEkNhcmRib2FyZCBJL08gMjAxNR0rGBU9JQHegj0qEAAASEIAAEhCAABIQgAASEJYADUpXA89OggeZnc-Ej6aPlAAYAM\u003e).\n\n\u003cbr /\u003e\n\nRedirection is also supported up to a maximum of 5 possible redirects before reaching the proper pattern.\n\nOnly URIs using HTTPS protocol are supported.\n\n\u003cbr /\u003e\n\n| Details ||\n|------------|---------------------------------------------------------------------------------------------------------------------------|\n| Parameters | |-------|--------------------------------------------------| | `uri` | The URI string. See above for supported formats. | |\n\n### ScanDeviceParams\n\n```c#\nvoid ScanDeviceParams()\n``` \nStarts QR Code scanning activity. \n\n### UpdateScreenParams\n\n```c#\nvoid UpdateScreenParams()\n``` \nUpdates screen parameters.\n\nThis method must be called at framerate to ensure the current screen orientation is properly taken into account by the head tracker."]]