SpatialEntity.Unpersist
bool Unpersist()
Remove this entity from persistent storage. Its name, if
it has one, is released right away, and it loses its Guid once
the asynchronous operation completes. Status is Pending until
then, or Partial if it fails. If a Persist is still in flight,
this waits for it to land and then undoes it. An entity from
FindAnchor that hasn’t loaded yet stops loading, and once the
unpersist lands it leaves the entity list, since there’s nothing
left to load.
| RETURNS: bool | False if this can’t work at all, like an invalid entity. |
static bool Unpersist(Guid guid)
Remove something from persistent storage using just its Guid, no live entity needed! This is how you clean up something stored in an earlier session that hasn’t been rediscovered, or never will be. If persistence is still starting up, this waits for it.
| Guid guid | A Guid from TryGetGuid, saved in an earlier session. |
| RETURNS: bool | False if this can’t work at all, like an empty Guid, or a system without persistence support. |
Examples
Removing anchors
static void RemoveAnchors(SpatialEntity anchor, Guid savedGuid)
{
// Gone for good, from this session, storage, and its name
anchor.Destroy();
// Stays for this session, but won't come back next launch
anchor.Unpersist();
// Cleans up a Guid from an earlier session, without loading it
SpatialEntity.Unpersist(savedGuid);
}
Found an issue with these docs, or have some additional questions? Create an Issue on Github!