ARAnchorManagerExtensions
Extensions to AR Foundation's ARAnchorManager
class.
Summary
Public static functions |
|
---|---|
GetPersistState(this ARAnchorManager anchorManager, ARAnchor anchor, out XRAnchorPersistStates state)
|
bool
Get persistence state of the given anchor.
|
GetPersistState(this ARAnchorManager anchorManager, Guid guid, out XRAnchorPersistStates state)
|
bool
Get persistence state of the given anchor by GUID.
|
GetPersistentId(this ARAnchorManager anchorManager, ARAnchor anchor)
|
Guid
Gets the persistent id associated with the given anchor, it can be used in TryLoad(ARAnchorManager, Guid) to retrieve the persisted anchor across multiple sessions.
|
Persist(this ARAnchorManager anchorManager, ARAnchor anchor)
|
bool
Try to save the anchor on device's local storage.
|
TryGetAllPersistedIds(this ARAnchorManager anchorManager, ref List< Guid > guids)
|
bool
Gets all persisted ids that are currently saved on the device's local storage.
|
TryLoad(this ARAnchorManager anchorManager, Guid guid)
|
bool
Try to load a persisted anchor from the given guid .
|
Unpersist(this ARAnchorManager anchorManager, Guid guid)
|
bool
Try to remove a persisted anchor from device's local storage.
|
Unpersist(this ARAnchorManager anchorManager, ARAnchor anchor)
|
bool
Try to remove a persisted anchor from device's local storage.
|
WaitUntilPersistState(this ARAnchorManager anchorManager, Guid guid, XRAnchorPersistStates targetState, Action< bool > onComplete, int timeout)
|
IEnumerator
Wait until an anchor has a given persistence state.
|
Public static functions
GetPersistState
bool GetPersistState( this ARAnchorManager anchorManager, ARAnchor anchor, out XRAnchorPersistStates state )
Get persistence state of the given anchor.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameters |
|
||||||
Returns |
Returns a boolean to indicate whether successfully got persistence state.
|
GetPersistState
bool GetPersistState( this ARAnchorManager anchorManager, Guid guid, out XRAnchorPersistStates state )
Get persistence state of the given anchor by GUID.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameters |
|
||||||
Returns |
Returns a boolean to indicate whether successfully got persistence state.
|
GetPersistentId
Guid GetPersistentId( this ARAnchorManager anchorManager, ARAnchor anchor )
Gets the persistent id associated with the given anchor, it can be used in TryLoad(ARAnchorManager, Guid) to retrieve the persisted anchor across multiple sessions.
If anchor is not a persisted anchor, returns Guid.Empty
.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
||||
Returns |
The persistent id of the given anchor.
|
Persist
bool Persist( this ARAnchorManager anchorManager, ARAnchor anchor )
Try to save the anchor on device's local storage.
If it succeeds, use either ARAnchorExtensions.GetPersistentId(ARAnchor) or GetPersistentId(ARAnchorManager, ARAnchor) to get the associated persistent id, then use TryLoad(ARAnchorManager, Guid) to retrieve the anchor from different sessions.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
||||
Returns |
Returns a boolean to indicate whether the anchor was successfully saved on the device's local storage.
|
TryGetAllPersistedIds
bool TryGetAllPersistedIds( this ARAnchorManager anchorManager, ref List< Guid > guids )
Gets all persisted ids that are currently saved on the device's local storage.
It can be used in TryLoad(ARAnchorManager, Guid) to retrieve the persisted anchors across multiple sessions or removed by Unpersist(ARAnchorManager, Guid).
Details | |||||
---|---|---|---|---|---|
Parameters |
|
||||
Returns |
Returns a boolean to indicate whether all stored ids were retrieved successfully.
|
TryLoad
bool TryLoad( this ARAnchorManager anchorManager, Guid guid )
Try to load a persisted anchor from the given guid .
If it succeeds, a new ARAnchor will be returned through ARAnchorsChangedEventArgs.added list. Use either ARAnchorExtensions.GetPersistentId(ARAnchor) or GetPersistentId(ARAnchorManager, ARAnchor) to confirm if it's the requested anchor.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
||||
Returns |
Returns a boolean to indicate whether successfully loaded the given guid .
|
Unpersist
bool Unpersist( this ARAnchorManager anchorManager, Guid guid )
Try to remove a persisted anchor from device's local storage.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
||||
Returns |
Returns a boolean to indicate whether the anchor was removed successfully from the device's local storage.
|
Unpersist
bool Unpersist( this ARAnchorManager anchorManager, ARAnchor anchor )
Try to remove a persisted anchor from device's local storage.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
||||
Returns |
Returns a boolean to indicate whether the anchor was removed successfully from the device's local storage.
|
WaitUntilPersistState
IEnumerator WaitUntilPersistState( this ARAnchorManager anchorManager, Guid guid, XRAnchorPersistStates targetState, Action< bool > onComplete, int timeout )
Wait until an anchor has a given persistence state.
Details | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Parameters |
|
||||||||||
Returns |
A coroutine that waits until the anchor has the target state or the timeout is reached.
|