docs.unity3d.com
    Show / Hide Table of Contents

    Class XRAnchorStore

    Provides access to the underlying Microsoft SpatialAnchorStore allowing a user to persist, reload, track and unpersist anchors between the SpatialAnchorStore and the a curerntly running instance of .

    The SpatialAnchorStore contains a snapshot of the data at the time of it's creation. If you update the store outside of the running application then you will need to make sure to destroy and recreate this.

    Getting an instance of this class will allocate an instance of the SpatialAnchorStore and retain it. You must dispose of this allocted resource or you may leak memory.

    Inheritance
    Object
    XRAnchorStore
    Namespace: UnityEngine.XR.WindowsMR
    Syntax
    public sealed class XRAnchorStore : IDisposable

    Properties

    PersistedAnchorNames

    Retrieve all the currently stored, named anchors from the SpatialAnchorStore

    If the list of names is not alrady created, we will as the anchor store for the current list of persisted names. This list will not change unless you modify the store by calling Clear(), TryPersistAnchor(TrackableId, String), UnpersistAnchor(String), or destroyong and re-creating an instance of XRAnchorStore.

    Has no impact on the set of currently tracked anchors in the running instance of .

    Declaration
    public IReadOnlyList<string> PersistedAnchorNames { get; }
    Property Value
    Type Description
    IReadOnlyList<String>

    Read only list of anchor names previously persisted to the store.

    Methods

    Clear()

    Clear all anchors from the store.

    Has no impact on the set of currently tracked anchors in the running instance of .

    Declaration
    public void Clear()

    Dispose()

    Declaration
    public void Dispose()

    Finalize()

    Declaration
    protected void Finalize()

    LoadAnchor(String)

    Take a persisted anchor from the SpatialAnchorStore with the given name and addes it to the current set of tracked in the runnign instance of .

    Declaration
    public TrackableId LoadAnchor(string name)
    Parameters
    Type Name Description
    String name

    The name of the anchor to load.

    Returns
    Type Description
    TrackableId

    The Id of the anchor.

    TryPersistAnchor(TrackableId, String)

    Given a trackable anchor with id, save the anchor to the SpatialAnchorStore with the given name.

    Has no impact on the set of currently tracked anchors in the running instance of .

    Declaration
    public bool TryPersistAnchor(TrackableId id, string name)
    Parameters
    Type Name Description
    TrackableId id

    The trackable id of a from the running instance of .

    String name

    The name you wish to assign to the anchor persisted in the SpatialAnchorStore.

    Returns
    Type Description
    Boolean

    False if there is no running instance of , the id or name is unknown, or if the underlying anchor store has any issues. True otherwise.

    UnpersistAnchor(String)

    Given an anchor with id and name, remove the anchor from the SpatialAnchorStore.

    Has no impact on the set of currently tracked anchors in the running instance of .

    Declaration
    public void UnpersistAnchor(string name)
    Parameters
    Type Name Description
    String name

    The name of a currently persisted anchor to remove from the SpatialAnchorStore.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023