Class WorldAnchorManager
Wrapper around Unity's WorldAnchorStore to simplify usage of persistence operations.
Implements
Namespace: Microsoft.MixedReality.Toolkit.Experimental.Utilities
Assembly: cs.temp.dll.dll
Syntax
public class WorldAnchorManager : MonoBehaviour, MonoBehaviour
Remarks
This class only functions when built for the WSA platform. It uses APIs that are only present on that platform.
Properties
AnchorDebugText
If non-null, verbose logging messages will be displayed on this TextMesh.
Declaration
public TextMesh AnchorDebugText { get; }
Property Value
Type | Description |
---|---|
TextMesh |
Remarks
Note that ShowDetailedLogs and AnchorDebugText will cause the same set of information to be displayed.
AnchorDebugText
If non-null, verbose logging messages will be displayed on this TextMesh.
Declaration
public TextMesh AnchorDebugText { get; }
Property Value
Type | Description |
---|---|
TextMesh |
Remarks
Note that ShowDetailedLogs and AnchorDebugText will cause the same set of information to be displayed.
PersistentAnchors
Enables anchors to be stored from subsequent game sessions.
Declaration
public bool PersistentAnchors { get; }
Property Value
Type | Description |
---|---|
Boolean |
PersistentAnchors
Enables anchors to be stored from subsequent game sessions.
Declaration
public bool PersistentAnchors { get; }
Property Value
Type | Description |
---|---|
Boolean |
ShowDetailedLogs
If true, more verbose logging messages will be written to the console window.
Declaration
public bool ShowDetailedLogs { get; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
Note that ShowDetailedLogs and AnchorDebugText will cause the same set of information to be displayed.
ShowDetailedLogs
If true, more verbose logging messages will be written to the console window.
Declaration
public bool ShowDetailedLogs { get; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
Note that ShowDetailedLogs and AnchorDebugText will cause the same set of information to be displayed.
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.
Declaration
public string AttachAnchor(GameObject gameObjectToAnchor, string anchorName = null)
Parameters
Type | Name | Description |
---|---|---|
GameObject | gameObjectToAnchor | The GameObject to attach the anchor to. |
String | anchorName | Name of the anchor. If none provided, the name of the GameObject will be used. |
Returns
Type | Description |
---|---|
String | The name of the newly attached anchor. |
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.
Declaration
public string AttachAnchor(GameObject gameObjectToAnchor, string anchorName = null)
Parameters
Type | Name | Description |
---|---|---|
GameObject | gameObjectToAnchor | The GameObject to attach the anchor to. |
String | anchorName | Name of the anchor. If none provided, the name of the GameObject will be used. |
Returns
Type | Description |
---|---|
String | The name of the newly attached anchor. |
RemoveAllAnchors()
Removes all anchors from the scene and deletes them from the anchor store.
Declaration
public void RemoveAllAnchors()
RemoveAllAnchors()
Removes all anchors from the scene and deletes them from the anchor store.
Declaration
public void RemoveAllAnchors()
RemoveAnchor(GameObject)
Removes the anchor component from the GameObject and deletes the anchor from the anchor store.
Declaration
public void RemoveAnchor(GameObject gameObjectToUnanchor)
Parameters
Type | Name | Description |
---|---|---|
GameObject | gameObjectToUnanchor | The GameObject reference with valid anchor to remove from the anchor store. |
RemoveAnchor(GameObject)
Removes the anchor component from the GameObject and deletes the anchor from the anchor store.
Declaration
public void RemoveAnchor(GameObject gameObjectToUnanchor)
Parameters
Type | Name | Description |
---|---|---|
GameObject | gameObjectToUnanchor | The GameObject reference with valid anchor to remove 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.
Declaration
public void RemoveAnchor(string anchorName)
Parameters
Type | Name | Description |
---|---|---|
String | anchorName | The name of the anchor to remove 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.
Declaration
public void RemoveAnchor(string anchorName)
Parameters
Type | Name | Description |
---|---|---|
String | anchorName | The name of the anchor to remove from the anchor store. |