WorldAnchorManager Class

Definition

Wrapper around Unity's WorldAnchorStore to simplify usage of persistence operations.

public ref class WorldAnchorManager : UnityEngine::MonoBehaviour
[UnityEngine.AddComponentMenu("Scripts/MRTK/SDK/WorldAnchorManager")]
public class WorldAnchorManager : UnityEngine.MonoBehaviour
[<UnityEngine.AddComponentMenu("Scripts/MRTK/SDK/WorldAnchorManager")>]
type WorldAnchorManager = class
    inherit MonoBehaviour
Public Class WorldAnchorManager
Inherits MonoBehaviour
Inheritance
UnityEngine.MonoBehaviour
WorldAnchorManager
Attributes
UnityEngine.AddComponentMenuAttribute

Remarks

This class only functions when built for the WSA platform using legacy XR. It uses APIs that are only present on that platform.

Constructors

WorldAnchorManager()

Properties

AnchorDebugText

If non-null, verbose logging messages will be displayed on this TextMesh.

AnchorStore

The WorldAnchorStore for the current application. Can be null when the application starts.

PersistentAnchors

Enables anchors to be stored from subsequent game sessions.

ShowDetailedLogs

If true, more verbose logging messages will be written to the console window.

Methods

AttachAnchor(GameObject, String)

Attaches an anchor to the GameObject. If the anchor store has an anchor with the specified name it will load the anchor, otherwise a new anchor will be saved under the specified name. If no anchor name is provided, the name of the anchor will be the same as the GameObject.

ExportAnchor(WorldAnchor)

Called after creating a new anchor.

ImportAnchor(String, GameObject)

Called before creating anchor. Used to check if import required.

RemoveAllAnchors()

Removes all anchors from the scene and deletes them from the anchor store.

RemoveAnchor(GameObject)

Removes the anchor component from the GameObject and deletes the anchor from the anchor store.

RemoveAnchor(String)

Removes the anchor from the anchor store, without a GameObject reference. If a GameObject reference can be found, the anchor component will be removed.

Applies to