docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct ARCollaborationDataBuilder

    Use this to construct an ARCollaborationData incrementally from serialized bytes.

    Implements
    IDisposable
    IEquatable<ARCollaborationDataBuilder>
    Inherited Members
    ValueType.ToString()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: UnityEngine.XR.ARKit
    Assembly: Unity.XR.ARKit.dll
    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[], int, int) or Append(NativeSlice<byte>)) or it has already been Dispose()d.

    Declaration
    public bool hasData { get; }
    Property Value
    Type Description
    bool

    length

    The number of bytes owned by this struct.

    Declaration
    public int length { get; }
    Property Value
    Type Description
    int
    See Also
    Append(byte[])
    Append(byte[], int, int)
    Append(NativeSlice<byte>)

    Methods

    Append(byte[])

    Appends all bytes 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 bytes to append.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if buffer is null.

    Append(byte[], int, int)

    Appends size bytes 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 bytes to append.

    int offset

    The offset within buffer to start appending bytes to the internal array.

    int size

    The number of bytes from buffer to append. Must be less than bytes.Length + offset>.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if buffer is null.

    ArgumentOutOfRangeException

    Thrown if size is less than zero.

    ArgumentOutOfRangeException

    Thrown if offset is less than zero.

    InvalidOperationException

    Thrown if size is less than zero or greater than the length of buffer.

    Append(NativeSlice<byte>)

    Appends bytes to an existing array of bytes.

    Declaration
    public void Append(NativeSlice<byte> bytes)
    Parameters
    Type Name Description
    NativeSlice<byte> bytes

    An array of bytes to append to the existing data.

    Exceptions
    Type Condition
    ArgumentException

    Thrown if bytes does not reference valid data.

    Dispose()

    Releases the native resource.

    Declaration
    public void Dispose()

    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
    bool

    true if obj is of type ARCollaborationDataBuilder and compares equal with Equals(ARCollaborationDataBuilder).

    Overrides
    ValueType.Equals(object)

    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
    bool

    true if all fields of this ARCollaborationDataBuilder compare equal to other.

    GetHashCode()

    Computes a hash code suitable for use in a Dictionary or HashSet.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int

    A hash code suitable for use in a Dictionary or HashSet.

    Overrides
    ValueType.GetHashCode()

    ToCollaborationData()

    Converts the bytes accumulated through calls to Append(byte[], int, int) 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

    operator ==(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
    bool

    true if all fields of this ARCollaborationDataBuilder compare equal to other.

    operator !=(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
    bool

    true if any of the fields of this ARCollaborationDataBuilder are not equal to other.

    Implements

    IDisposable
    IEquatable<T>
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)