{!See https://docs.google.com/document/d/1takg_GmIBBKKTj-GHZCwzxohpQz7Bhekivkk72kYMtE/edit for reference implementation of OneTrust, dataLayer and GTM} {!OneTrust Cookies Consent} {!OneTrust Cookies Consent end} {!dataLayer initialization push} {!dataLayer initialization push end} {!Google Tag Manager} {!Google Tag Manager end} Struct NativeReference<T> | Collections | 2.3.0-pre.3
docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct NativeReference<T>

    An unmanaged single value.

    Implements
    INativeDisposable
    Namespace: Unity.Collections
    Assembly: solution.dll
    Syntax
    [NativeContainer]
    public struct NativeReference<T> : INativeDisposable where T : unmanaged
    Type Parameters
    Name Description
    T

    The type of value.

    Remarks

    The functional equivalent of an array of length 1. When you need just one value, NativeReference can be preferable to an array because it better conveys the intent.

    Constructors

    Name Description
    NativeReference(AllocatorHandle, NativeArrayOptions)

    Initializes and returns an instance of NativeReference.

    NativeReference(T, AllocatorHandle)

    Initializes and returns an instance of NativeReference.

    Properties

    Name Description
    IsCreated

    Whether this reference has been allocated (and not yet deallocated).

    Value

    The value stored in this reference.

    Methods

    Name Description
    AsReadOnly()

    Returns a read-only reference aliasing the value of this reference.

    Copy(NativeReference<T>, NativeReference<T>)

    Copies the value of a reference to another reference.

    CopyFrom(NativeReference<T>)

    Copy the value of another reference to this reference.

    CopyTo(NativeReference<T>)

    Copy the value of this reference to another reference.

    Dispose()

    Releases all resources (memory and safety handles).

    Dispose(JobHandle)

    Creates and schedules a job that will release all resources (memory and safety handles) of this reference.

    Equals(object)

    Returns true if the value stored in this reference is equal to an object.

    Equals(NativeReference<T>)

    Returns true if the value stored in this reference is equal to the value stored in another reference.

    GetHashCode()

    Returns the hash code of this reference.

    Operators

    Name Description
    operator ==(NativeReference<T>, NativeReference<T>)

    Returns true if the values stored in two references are equal.

    implicit operator ReadOnly(NativeReference<T>)

    Returns a read-only native reference that aliases the content of a native reference.

    operator !=(NativeReference<T>, NativeReference<T>)

    Returns true if the values stored in two references are unequal.

    Extension Methods

    NativeReferenceUnsafeUtility.GetUnsafePtrWithoutChecks<T>(NativeReference<T>)
    NativeReferenceUnsafeUtility.GetUnsafePtr<T>(NativeReference<T>)
    NativeReferenceUnsafeUtility.GetUnsafeReadOnlyPtr<T>(NativeReference<T>)
    In This Article
    Back to top
    Copyright © 2023 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)