private void CreateNewCloudSession() { cloudSpatialAnchorSession = new CloudSpatialAnchorSession(); cloudSpatialAnchorSession.Configuration.AccountId = SpatialAnchorsAccountId.Trim(); cloudSpatialAnchorSession.Configuration.AccountKey = SpatialAnchorsAccountKey.Trim(); cloudSpatialAnchorSession.LogLevel = SessionLogLevel.All; cloudSpatialAnchorSession.OnLogDebug += CloudSpatialAnchorSession_OnLogDebug; cloudSpatialAnchorSession.SessionUpdated += CloudSpatialAnchorSession_SessionUpdated; cloudSpatialAnchorSession.AnchorLocated += CloudSpatialAnchorSession_AnchorLocated; cloudSpatialAnchorSession.LocateAnchorsCompleted += CloudSpatialAnchorSession_LocateAnchorsCompleted; cloudSpatialAnchorSession.Error += CloudSpatialAnchorSession_Error; #if UNITY_WSA && !UNITY_EDITOR // AAD user token scenario to get an authentication token //cloudSpatialAnchorSession.TokenRequired += async (object sender, SpatialServices.TokenRequiredEventArgs args) => //{ // CloudSpatialAnchorSessionDeferral deferral = args.GetDeferral(); // // AAD user token scenario to get an authentication token // args.AuthenticationToken = await AuthenticationHelper.GetAuthenticationTokenAsync(); // deferral.Complete(); //}; #endif #if UNITY_IOS cloudSpatialAnchorSession.Session = arkitSession.GetNativeSessionPtr(); #elif UNITY_ANDROID cloudSpatialAnchorSession.Session = GoogleARCoreInternal.ARCoreAndroidLifecycleManager.Instance.NativeSession.SessionHandle; #elif UNITY_WSA || WINDOWS_UWP // No need to set a native session pointer for HoloLens. #else throw new NotSupportedException("The platform is not supported."); #endif }
// Initial Session private void InitializeCloudSession() { cloudSpatialAnchorSession = new CloudSpatialAnchorSession(); cloudSpatialAnchorSession.Configuration.AccountId = SpatialAnchorsAccountId.Trim(); cloudSpatialAnchorSession.Configuration.AccountKey = SpatialAnchorsAccountKey.Trim(); cloudSpatialAnchorSession.LogLevel = SessionLogLevel.All; cloudSpatialAnchorSession.Error += CloudSpatialAnchorSession_Error; cloudSpatialAnchorSession.OnLogDebug += CloudSpatialAnchorSession_OnLogDebug; cloudSpatialAnchorSession.SessionUpdated += CloudSpatialAnchorSession_SessionUpdated; cloudSpatialAnchorSession.AnchorLocated += CloudSpatialAnchorSession_AnchorLocated; cloudSpatialAnchorSession.LocateAnchorsCompleted += CloudSpatialAnchorSession_LocateAnchorsCompleted; cloudSpatialAnchorSession.Start(); Debug.Log("ASA Info: Session was initialized."); }