public async void DeleteCurrentAnchor() { if (aRTapHandler.objectToPlace != null) { Log.debug("Trying to discard anchor"); if (anchorLerper.hasAnchorSelected) { Log.debug("Anchor has been lerped"); anchorLerper.PrepareToDelete(); } Log.debug("Destroying"); Destroy(aRTapHandler.objectToPlace); Log.debug("Setting text"); anchorInfoText.GetComponentInParent <FadeText>().SetText($"Anchor creation canceled"); return; } Log.debug("Trying to delete existing anchor"); AnchorProperties anchorToDeleteProperties = aRTapHandler.currentSelectedAnchor.GetComponent <AnchorProperties>(); anchorInfoText.text = $"Deleting anchor:\n{anchorToDeleteProperties.anchorLabel}..."; Log.debug($"Try to Delete CloudSpatialAnchor: {currentCloudSpatialAnchor.Identifier} "); await spatialAnchorManager.DeleteAnchorAsync(currentCloudSpatialAnchor); Log.debug($"CloudSpatialAnchor is Deleted: {currentCloudSpatialAnchor.Identifier}"); anchorInfoText.GetComponentInParent <FadeText>().SetText($"Anchor deleted \nLabel: {anchorToDeleteProperties.anchorLabel}"); Destroy(anchorToDeleteProperties.button); FindObjectOfType <AnchorButtonPopulator>().RemoveAnchorFromDictionary(anchorToDeleteProperties.anchorID); await anchorConverter.ResetSession(); anchorConverter.FindAnchorsByLocation(); }
/// <summary> /// Azure Spatial Anchorsサービスから取得済みのすべてのアンカーを削除します。 /// </summary> public async void DeleteAllAzureAnchor() { try { Debug.Log("\nAnchorModuleScript.DeleteAllAzureAnchor()"); // Notify AnchorFeedbackScript OutputLog("Trying to find Azure anchor..."); foreach (var AnchorInfo in locatedAnchors.Values) { // Delete the Azure anchor with the ID specified off the server and locally await cloudManager.DeleteAnchorAsync(AnchorInfo); } locatedAnchors.Clear(); OutputLog("Trying to find Azure anchor...Successfully"); } catch (Exception e) { Debug.Log(e); throw; } }
public async void DeleteAzureAnchor() { Debug.Log("\nAnchorModuleScript.DeleteAzureAnchor()"); // Notify AnchorFeedbackScript OnDeleteASAAnchor?.Invoke(); // Delete the Azure anchor with the ID specified off the server and locally await cloudManager.DeleteAnchorAsync(currentCloudAnchor); currentCloudAnchor = null; Debug.Log("Azure anchor deleted successfully"); }
/// <summary> /// Delete the cloud anchor corresponding to a local ARAnchor. /// </summary> private async void DeleteAnchorFromCloudAsync(GameObject gameObject) { CloudNativeAnchor cloudNativeAnchor = gameObject.GetComponent <CloudNativeAnchor>(); CloudSpatialAnchor cloudSpatialAnchor = cloudNativeAnchor.CloudAnchor; Debug.Log($"Deleting cloud anchor: {cloudSpatialAnchor.Identifier}"); await m_cloudSpatialAnchorManager.DeleteAnchorAsync(cloudSpatialAnchor); m_cloudSpatialAnchorIDs.Remove(cloudSpatialAnchor.Identifier); Destroy(cloudNativeAnchor); Debug.Log($"Cloud anchor deleted!"); // Update the visuals of the gameobject gameObject.GetComponent <SampleSpatialAnchor>().Persisted = false; gameObject.GetComponent <SampleSpatialAnchor>().Identifier = ""; }