Struct ARCollaborationDataBuilder
Use this to construct an ARCollaborationData incrementally from serialized bytes.
Inherited Members
Namespace: UnityEngine.XR.ARKit
Syntax
public struct ARCollaborationDataBuilder : IDisposable, IEquatable<ARCollaborationDataBuilder>
Remarks
This struct can be useful if you receive data through a stream. If you already have all the bytes, use a ARCollaborationData constructor instead. This struct represents a native resource and must be explicitly disposed when no longer needed. While this struct is not thread safe, you can construct, Dispose, and Append from any thread.
Properties
hasData
Whether the ARCollaborationDataBuilder has allocated any data. If true
,
this struct must be disposed to avoid leaking native resources. If false
, this struct
either never allocated memory
(with Append(Byte[], Int32, Int32) or Append(NativeSlice<Byte>))
or it has already been Dispose()d.
Declaration
public readonly bool hasData { get; }
Property Value
Type | Description |
---|---|
Boolean |
length
The number of bytes owned by this struct.
Declaration
public readonly int length { get; }
Property Value
Type | Description |
---|---|
Int32 |
See Also
Methods
Append(Byte[])
Appends all byte
s of the array buffer
to an existing array of bytes.
Declaration
public void Append(byte[] buffer)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | buffer | A buffer containing |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
Append(Byte[], Int32, Int32)
Appends size
byte
s of the array buffer
to an existing array of bytes.
Declaration
public void Append(byte[] buffer, int offset, int size)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | buffer | A buffer containing |
Int32 | offset | The offset within |
Int32 | size | The number of bytes from |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
ArgumentOutOfRangeException | Thrown if |
ArgumentOutOfRangeException | Thrown if |
InvalidOperationException | Thrown if |
Append(NativeSlice<Byte>)
Appends bytes
to an existing array of bytes.
Declaration
public void Append(NativeSlice<byte> bytes)
Parameters
Type | Name | Description |
---|---|---|
Unity.Collections.NativeSlice<Byte> | bytes | An array of bytes to append to the existing data. |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown if |
Dispose()
Releases the native resource.
Declaration
public void Dispose()
Implements
Equals(Object)
IEquatable interface. Compares for equality.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The object to compare for equality. |
Returns
Type | Description |
---|---|
Boolean |
|
Overrides
Equals(ARCollaborationDataBuilder)
IEquatable interface. Compares for equality.
Declaration
public bool Equals(ARCollaborationDataBuilder other)
Parameters
Type | Name | Description |
---|---|---|
ARCollaborationDataBuilder | other | The ARCollaborationDataBuilder to compare against. |
Returns
Type | Description |
---|---|
Boolean |
|
Implements
GetHashCode()
Computes a hash code suitable for use in a Dictionary
or HashSet
.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | A hash code suitable for use in a |
Overrides
ToCollaborationData()
Converts the bytes accumulated through calls to Append(Byte[], Int32, Int32) to an ARCollaborationData. The caller is responsible for disposing the returned ARCollaborationData.
Declaration
public ARCollaborationData ToCollaborationData()
Returns
Type | Description |
---|---|
ARCollaborationData | A new ARCollaborationData constructed from the bytes added to this ARCollaborationDataBuilder. |
Exceptions
Type | Condition |
---|---|
NotSupportedException | Thrown if ARCollaborationData is not supported. Check for support with supportsCollaboration. |
InvalidOperationException | Thrown if hasData is false. |
Operators
Equality(ARCollaborationDataBuilder, ARCollaborationDataBuilder)
Compares for equality. Same as Equals(ARCollaborationDataBuilder).
Declaration
public static bool operator ==(ARCollaborationDataBuilder lhs, ARCollaborationDataBuilder rhs)
Parameters
Type | Name | Description |
---|---|---|
ARCollaborationDataBuilder | lhs | The left-hand side of the comparison. |
ARCollaborationDataBuilder | rhs | The right-hand side of the comparison. |
Returns
Type | Description |
---|---|
Boolean |
|
Inequality(ARCollaborationDataBuilder, ARCollaborationDataBuilder)
Compares for inequality. Same as !
Equals(ARCollaborationDataBuilder).
Declaration
public static bool operator !=(ARCollaborationDataBuilder lhs, ARCollaborationDataBuilder rhs)
Parameters
Type | Name | Description |
---|---|---|
ARCollaborationDataBuilder | lhs | The left-hand side of the comparison. |
ARCollaborationDataBuilder | rhs | The right-hand side of the comparison. |
Returns
Type | Description |
---|---|
Boolean |
|