public override bool TryCreateLocalizationSession(IPeerConnection peerConnection, SpatialAnchorsConfiguration settings, out ISpatialLocalizationSession session) { if ((string.IsNullOrWhiteSpace(settings.AccountId) || string.IsNullOrWhiteSpace(settings.AccountKey)) && string.IsNullOrWhiteSpace(settings.AuthenticationToken) && string.IsNullOrWhiteSpace(settings.AccessToken)) { Debug.LogError("Authentication method not configured for Azure Spatial Anchors, ensure you configured AccountID and AccountKey, or Authentication Token, or Access Token.", this); session = null; return(false); } #if !SPATIALALIGNMENT_ASA Debug.LogError("Attempting to use SpatialAnchorLocalizer but ASA is not enabled for this build"); session = null; return(false); #elif UNITY_WSA && SPATIALALIGNMENT_ASA session = new SpatialCoordinateLocalizationSession(this, new SpatialAnchorsUWPCoordinateService(settings), settings, peerConnection); return(true); #elif UNITY_ANDROID && SPATIALALIGNMENT_ASA session = new SpatialCoordinateLocalizationSession(this, new SpatialAnchorsAndroidCoordinateService(settings), settings, peerConnection); return(true); #elif UNITY_IOS && SPATIALALIGNMENT_ASA session = new SpatialCoordinateLocalizationSession(this, new SpatialAnchorsIOSCoordinateService(settings), settings, peerConnection); return(true); #else Debug.LogError("AzureSpatialAnchors is not supported on the current platform."); session = null; return(false); #endif }
public override bool TryCreateLocalizationSession(IPeerConnection peerConnection, SpatialAnchorsConfiguration settings, out ISpatialLocalizationSession session) { if ((string.IsNullOrWhiteSpace(settings.AccountId) || string.IsNullOrWhiteSpace(settings.AccountKey)) && string.IsNullOrWhiteSpace(settings.AuthenticationToken) && string.IsNullOrWhiteSpace(settings.AccessToken)) { Debug.LogError("Authentication method not configured for Azure Spatial Anchors, ensure you configured AccountID and AccountKey, or Authentication Token, or Access Token.", this); session = null; return(false); } session = new SpatialCoordinateLocalizationSession(this, new SpatialAnchorsCoordinateService(this.gameObject, settings), settings, peerConnection); return(session != null); }