protected override SpongyAnchor DestroyAnchor(AnchorId id, SpongyAnchor spongyAnchor)
        {
            SpongyAnchorXR spongyAnchorXR = spongyAnchor as SpongyAnchorXR;

            if (spongyAnchorXR != null)
            {
                Debug.Assert(anchorsByTrackableId[spongyAnchorXR.TrackableId] == spongyAnchorXR);
                anchorsByTrackableId.Remove(spongyAnchorXR.TrackableId);
                xrAnchorManager.TryRemoveAnchor(spongyAnchorXR.TrackableId);
                GameObject.Destroy(spongyAnchorXR.gameObject);
            }
            RemoveSpongyAnchorById(id);

            return(null);
        }
Beispiel #2
0
        IEnumerator RemoveAndCheckAnchor(TrackableId id, Action <TrackableId> callback)
        {
            XRAnchorSubsystem rpsub = ActiveLoader.GetLoadedSubsystem <XRAnchorSubsystem>();

            Assert.NotNull(rpsub);

            rpsub.TryRemoveAnchor(id);

            yield return(null);

            TrackableChanges <XRAnchor>?currentRps = rpsub.GetChanges(Allocator.Temp);

            Assert.IsNotNull(currentRps);
            Assert.AreNotEqual(0, currentRps?.removed.Length ?? 0);

            TrackableId?rpRemoved = currentRps?.removed[0] ?? null;

            if (callback != null)
            {
                callback.Invoke(rpRemoved ?? defaultId);
            }
        }