/// <summary> /// Set the token to use when authenticating with the ARCore Cloud Anchor service /// on the iOS platform. This should be called each time the application's /// token is refreshed. /// </summary> /// <param name="anchorManager">The ARAnchorManager instance.</param> /// <param name="authToken">The authentication token to set.</param> public static void SetAuthToken(this ARAnchorManager anchorManager, string authToken) { // Only iOS needs AuthToken for Cloud Anchor persistence. #if ARCORE_EXTENSIONS_IOS_SUPPORT && UNITY_IOS if (!string.IsNullOrEmpty(RuntimeConfig.Instance.IOSCloudServicesApiKey)) { Debug.LogError( "Cannot set token in applications built using the 'API Key' " + "authentication strategy. To use it, check Edit > Project Settings " + "> XR > ARCore Extensions > iOS Support Enabled and " + "set iOS Authentication Strategy to Authentication Token."); return; } if (string.IsNullOrEmpty(authToken)) { Debug.LogError("Cannot set empty token in applications."); return; } SessionApi.SetAuthToken( ARCoreExtensions._instance.currentARCoreSessionHandle, authToken); #else Debug.LogError("AuthToken only works with iOS Supported enabled in " + "ARCore Extensions Project Settings and the target platform has set to iOS."); #endif // ARCORE_IOS_SUPPORT && UNITY_IOS }