private void OnDestroy() { enableProcessing = false; if (cloudSpatialAnchorSession != null) { cloudSpatialAnchorSession.Dispose(); cloudSpatialAnchorSession = null; } if (anchorLocateCriteria != null) { anchorLocateCriteria = null; } _instance = null; }
/// <summary> /// Start is called on the frame when a script is enabled just before any /// of the Update methods are called the first time. /// </summary> public override void Start() { feedbackBox = XRUXPicker.Instance.GetFeedbackText(); if (feedbackBox == null) { Debug.Log($"{nameof(feedbackBox)} not found in scene by XRUXPicker."); Destroy(this); return; } CloudManager = AzureSpatialAnchorsDemoWrapper.Instance; if (CloudManager == null) { feedbackBox.text = "AzureSpatialAnchorsDemoWrapper doesn't exist in the scene. Make sure it has been added."; return; } if (!SanityCheckAccessConfiguration()) { feedbackBox.text = $"{nameof(AzureSpatialAnchorsDemoWrapper.SpatialAnchorsAccountId)} and {nameof(AzureSpatialAnchorsDemoWrapper.SpatialAnchorsAccountKey)} must be set on AzureSpatialAnchorsDemoConfig in Examples/Resources"; } if (AnchoredObjectPrefab == null) { feedbackBox.text = "CreationTarget must be set on the demo script."; return; } CloudManager.OnSessionUpdated += CloudManager_SessionUpdated; CloudManager.OnAnchorLocated += CloudManager_OnAnchorLocated; CloudManager.OnLocateAnchorsCompleted += CloudManager_OnLocateAnchorsCompleted; CloudManager.OnLogDebug += CloudManager_OnLogDebug; CloudManager.OnSessionError += CloudManager_OnSessionError; base.Start(); }