private IEnumerator AdjustMarkerPosition(Vector3 delta)
    {
        if (MarkerViveOrigin != null)
        {
            MarkerViveOrigin.DetachAnchor();

            while (!MarkerViveOrigin.IsAnchorManagerQueueEmpty())
            {
                yield return(null);
            }

            MarkerViveOrigin.transform.position = MarkerViveOrigin.transform.position + delta;

            while (!MarkerViveOrigin.IsAnchorManagerQueueEmpty())
            {
                yield return(null);
            }

            MarkerViveOrigin.AttachAnchor();

            while (!MarkerViveOrigin.IsAnchorManagerQueueEmpty())
            {
                yield return(null);
            }
        }
        else
        {
            Debug.LogError("Cannot AdjustMarkerPosition when there is no MarkerViveOrigin");
        }
    }
    private AnchorMarker CreateNewMarker(string newMarkerId)
    {
        Vector3 hitPoint          = Camera.main.transform.position + Camera.main.transform.forward;
        Vector3 directionToCamera = -Camera.main.transform.forward;

        directionToCamera.y = 0f;

        GameObject   marker       = (GameObject)Instantiate(WorldAnchorMarker, hitPoint, Quaternion.LookRotation(directionToCamera));
        AnchorMarker anchorMarker = marker.GetComponent <AnchorMarker>();

        anchorMarker.Init(newMarkerId, worldAnchorManager);

        anchorMarker.AttachAnchor();
        return(anchorMarker);
    }
    private void WorldAnchorStoreLoaded(WorldAnchorStore store)
    {
        Debug.Log("AnchorPlacer: WorldAnchorStoreLoaded");

        string[] anchorIdsInStore = store.GetAllIds();

        List <string> persistedAnchorMarkerIdsToRemove = new List <string>();

        foreach (string persistedMarkerId in PersistedAnchorMarkersIds)
        {
            bool markerIdInAnchorStore = Array.Exists(anchorIdsInStore, id => id == persistedMarkerId);

            bool markerIdShouldBeSpawned = markerIdInAnchorStore && (persistedMarkerId == ANCHOR_VIVE_ORIGIN);

            if (markerIdShouldBeSpawned)
            {
                Debug.Log("Reload Marker from store with id [" + persistedMarkerId + "]");
                GameObject   markerClone  = (GameObject)Instantiate(WorldAnchorMarker, Vector3.zero, Quaternion.identity);
                AnchorMarker anchorMarker = markerClone.GetComponent <AnchorMarker>();
                anchorMarker.Init(persistedMarkerId, worldAnchorManager);
                anchorMarker.AttachAnchor();
                Markers.Add(anchorMarker.gameObject);

                MarkerViveOrigin = anchorMarker;
            }
            else
            {
                Debug.Log("Marker with id [" + persistedMarkerId + "] was not found in AnchorStore");

                persistedAnchorMarkerIdsToRemove.Add(persistedMarkerId);
            }
        }

        foreach (string persistedMarkerIdToRemove in persistedAnchorMarkerIdsToRemove)
        {
            Debug.Log("Removing marker with id [" + persistedMarkerIdToRemove + "]");
            PersistedAnchorMarkersIds.Remove(persistedMarkerIdToRemove);
        }

        SaveMarkersToFile();
    }