Struct ARWorldMap
The space-mapping state and set of planes and anchors from
an AR session. This is a wrapper for
ARKit's ARWorldMap.
Note: The ARWorldMap
must be explicitly disposed to avoid leaking native resources.
Inherited Members
Namespace: UnityEngine.XR.ARKit
Assembly: Unity.XR.ARKit.dll
Syntax
public struct ARWorldMap : IDisposable, IEquatable<ARWorldMap>
Properties
valid
Use this to determine whether this ARWorldMap
is valid, or
if it has been disposed.
Declaration
public bool valid { get; }
Property Value
Type | Description |
---|---|
bool |
Methods
Dispose()
Disposes of the world map. This releases the native ARWorldMap resource.
Declaration
public void Dispose()
Equals(object)
Tests for equality.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The |
Returns
Type | Description |
---|---|
bool |
|
Overrides
Equals(ARWorldMap)
Tests for equality.
Declaration
public bool Equals(ARWorldMap other)
Parameters
Type | Name | Description |
---|---|---|
ARWorldMap | other | The other ARWorldMap to compare against. |
Returns
Type | Description |
---|---|
bool |
|
GetHashCode()
Generates a hash suitable for use with containers like HashSet
and Dictionary
.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A hash code generated from this object's fields. |
Overrides
Serialize(Allocator)
Serialize the ARWorldMap
to an array of bytes. This array can be saved to disk
and loaded at another time to persist the session, or sent over a network
to another ARKit-enabled app to share the session.
It is an error to call this method after the ARWorldMap
has been disposed.
The caller owns the returned
NativeArray
and is responsible for disposing it.
Declaration
public NativeArray<byte> Serialize(Allocator allocator)
Parameters
Type | Name | Description |
---|---|---|
Allocator | allocator | The allocator to use for the returned NativeArray of bytes. |
Returns
Type | Description |
---|---|
NativeArray<byte> | An array of bytes representing the serialized |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown if the world map is not valid. |
InvalidOperationException | Thrown if the world map could not be serialized to a byte array. |
TryDeserialize(NativeArray<byte>, out ARWorldMap)
Create a new ARWorldMap
from a NativeArray
of bytes produced
from Serialize(Allocator). Use this to create an ARWorldMap
from
a serialized array of bytes, either loaded from disk or sent from another device.
Declaration
public static bool TryDeserialize(NativeArray<byte> serializedWorldMap, out ARWorldMap worldMap)
Parameters
Type | Name | Description |
---|---|---|
NativeArray<byte> | serializedWorldMap | An array of bytes representing a serialized |
ARWorldMap | worldMap | On success, holds the deserialized ARWorldMap. |
Returns
Type | Description |
---|---|
bool |
|
Operators
operator ==(ARWorldMap, ARWorldMap)
Tests for equality. Same as Equals(ARWorldMap).
Declaration
public static bool operator ==(ARWorldMap lhs, ARWorldMap rhs)
Parameters
Type | Name | Description |
---|---|---|
ARWorldMap | lhs | The left-hand side of the comparison. |
ARWorldMap | rhs | The right-hand side of the comparison. |
Returns
Type | Description |
---|---|
bool |
|
operator !=(ARWorldMap, ARWorldMap)
Tests for inequality. Same as !
Equals(ARWorldMap).
Declaration
public static bool operator !=(ARWorldMap lhs, ARWorldMap rhs)
Parameters
Type | Name | Description |
---|---|---|
ARWorldMap | lhs | The left-hand side of the comparison. |
ARWorldMap | rhs | The right-hand side of the comparison. |
Returns
Type | Description |
---|---|
bool |
|