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
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 readonly bool valid { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
Dispose()
Disposes of the world map. This releases the native ARWorldMap resource.
Declaration
public void Dispose()
Implements
Equals(Object)
Tests for equality.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The |
Returns
Type | Description |
---|---|
Boolean |
|
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 |
---|---|
Boolean |
|
Implements
GetHashCode()
Generates a hash suitable for use with containers like HashSet
and Dictionary
.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | 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 |
---|---|---|
Unity.Collections.Allocator | allocator | The allocator to use for the returned NativeArray of bytes. |
Returns
Type | Description |
---|---|
Unity.Collections.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 |
---|---|---|
Unity.Collections.NativeArray<Byte> | serializedWorldMap | An array of bytes representing a serialized |
ARWorldMap | worldMap | On success, holds the deserialized ARWorldMap. |
Returns
Type | Description |
---|---|
Boolean |
|
Operators
Equality(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 |
---|---|
Boolean |
|
Inequality(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 |
---|---|
Boolean |
|