XRGoogleCloudFeature

This OpenXRInteractionFeature configures Android XR extensions XR_ANDROID_google_cloud_auth at runtime and provides XRGoogleCloudManager to manage Google Cloud API usages.

Summary

Inheritance

Inherits from: OpenXRFeature, Google.XR.Extensions.IXRSpatialSdk

Public attributes

ExtensionStrings = "XR_EXT_future " + "XR_ANDROID_google_cloud_auth "
const string
The OpenXR Extension string.
FeatureId = "com.google.xr.extensions.google_cloud"
const string
The feature ID string.
UiName = "Android XR: Google Cloud"
const string
The UI name shows on the XR Plug-in Management panel, it helps users to understand validation errors and expected fixes.

Public static attributes

IsExtensionEnabled => _extensionEnabled
bool
Gets if the required OpenXR extension is enabled.
OnAuthResultReceived
The event fired when authentication errors have been triggered by other Google Cloud API calls.

Public functions

GetTargetVersion()
Gets the target version of the given feature if applicable.
TrySetAuthenticationAsync(XRAuthenticationStrategy strategy, string credential)
async Awaitable< OpenXRResultStatus >
Attempts to set authentication through an async operation.
TrySetStrategy(XRAuthenticationStrategy strategy, string credential)
bool
Editor helper to set automatic strategy from scripts.

Public attributes

ExtensionStrings

const string ExtensionStrings =
            "XR_EXT_future " +
            "XR_ANDROID_google_cloud_auth "

The OpenXR Extension string.

Used to check if this extensions is available or enabled.

FeatureId

const string FeatureId = "com.google.xr.extensions.google_cloud"

The feature ID string.

UiName

const string UiName = "Android XR: Google Cloud"

The UI name shows on the XR Plug-in Management panel, it helps users to understand validation errors and expected fixes.

Public static attributes

IsExtensionEnabled

bool IsExtensionEnabled => _extensionEnabled

Gets if the required OpenXR extension is enabled.

When OpenXR runtime is waiting, it returns null. Otherwise, it indicates whether the XR_ANDROID_google_cloud_auth extension is available on current device.

OnAuthResultReceived

Action< XRGoogleCloudAuthResult > OnAuthResultReceived

The event fired when authentication errors have been triggered by other Google Cloud API calls.

If it's caused by XRGoogleCloudAuthError.AuthError, you may call TrySetAuthenticationAsync manually with a valid configuration, and access Google Cloud APIs after succeed.

Public functions

GetTargetVersion

XRSpatialSdkVersions GetTargetVersion()

Gets the target version of the given feature if applicable.

TrySetAuthenticationAsync

async Awaitable< OpenXRResultStatus > TrySetAuthenticationAsync(
  XRAuthenticationStrategy strategy,
  string credential
)

Attempts to set authentication through an async operation.

Details
Parameters
strategy
The target strategy to be used for authentication. It must be a valid one other than XRAuthenticationStrategy.None.
credential
The credentials passing for the given strategy . Ignored for XRAuthenticationStrategy.Keyless. Invalid credential will result in XRGoogleCloudAuthError.AuthError from all calls to functions that depend on Cloud authorization.
Returns
The result of the async operation. Use OpenXRResultStatus.IsSuccess() to confirm if succeed. When failed with OpenXRResultStatus.StatusCode.PlatformError, check OpenXRResultStatus.nativeStatusCode for the failure reason. It might be XrResultAndroid.KeylessNotSetup, XrResultAndroid.KeylessAuthFailed or common OpenXR errors from XrResult.

TrySetStrategy

bool TrySetStrategy(
  XRAuthenticationStrategy strategy,
  string credential
)

Editor helper to set automatic strategy from scripts.

Details
Parameters
strategy
The strategy to try on session start.
credential
The credential to be used on session start.
Returns
Returns true if it succeeded; otherwise, returns false.