{!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 UnsafeList<T> | Collections | 2.3.0-pre.3
docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct UnsafeList<T>

    An unmanaged, resizable list.

    Implements
    INativeDisposable
    INativeList<T>
    IIndexable<T>
    Namespace: Unity.Collections.LowLevel.Unsafe
    Assembly: solution.dll
    Syntax
    public struct UnsafeList<T> : INativeDisposable, INativeList<T>, IIndexable<T> where T : unmanaged
    Type Parameters
    Name Description
    T

    The type of the elements.

    Constructors

    Name Description
    UnsafeList(int, AllocatorHandle, NativeArrayOptions)

    Initializes and returns an instance of UnsafeList.

    UnsafeList(T*, int)

    Initializes and returns an instance of UnsafeList.

    Fields

    Name Description
    Allocator

    The allocator used to create the internal buffer.

    Ptr

    The internal buffer of this list.

    m_capacity

    The number of elements that can fit in the internal buffer.

    m_length

    The number of elements.

    Properties

    Name Description
    Capacity

    The number of elements that can fit in the internal buffer.

    IsCreated

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

    IsEmpty

    Whether the list is empty.

    this[int]

    The element at an index.

    Length

    The number of elements.

    Methods

    Name Description
    Add(in T)

    Adds an element to the end of the list.

    AddNoResize(T)

    Adds an element to the end of this list.

    AddRange(void*, int)

    Copies the elements of a buffer to the end of this list.

    AddRange(UnsafeList<T>)

    Copies the elements of another list to the end of the list.

    AddRangeNoResize(void*, int)

    Copies elements from a buffer to the end of this list.

    AddRangeNoResize(UnsafeList<T>)

    Copies the elements of another list to the end of this list.

    AddReplicate(in T, int)

    Appends value count times to the end of this list.

    AsParallelReader()

    Obsolete. Use AsReadOnly() instead.

    AsParallelWriter()

    Returns a parallel writer of this list.

    AsReadOnly()

    Returns a read only of this list.

    Clear()

    Sets the length to 0.

    CopyFrom(in UnsafeList<T>)

    Copies all elements of specified container to this container.

    CopyFrom(in NativeArray<T>)

    Copies all elements of specified container to this container.

    Create(int, AllocatorHandle, NativeArrayOptions)

    Returns a new list.

    Destroy(UnsafeList<T>*)

    Destroys the list.

    Dispose()

    Releases all resources (memory).

    Dispose(JobHandle)

    Creates and schedules a job that frees the memory of this list.

    ElementAt(int)

    Returns a reference to the element at a given index.

    GetEnumerator()

    Returns an enumerator over the elements of the list.

    InsertRange(int, int)

    Shifts elements toward the end of this list, increasing its length.

    InsertRangeWithBeginEnd(int, int)

    Shifts elements toward the end of this list, increasing its length.

    RemoveAt(int)

    Removes the element at an index, shifting everything above it down by one. Decrements the length by 1.

    RemoveAtSwapBack(int)

    Copies the last element of this list to the specified index. Decrements the length by 1.

    RemoveRange(int, int)

    Removes N elements in a range, shifting everything above the range down by N. Decrements the length by N.

    RemoveRangeSwapBack(int, int)

    Copies the last N elements of this list to a range in this list. Decrements the length by N.

    Resize(int, NativeArrayOptions)

    Sets the length, expanding the capacity if necessary.

    SetCapacity(int)

    Sets the capacity.

    TrimExcess()

    Sets the capacity to match the length.

    Extension Methods

    UnsafeListExtensions.Contains<T, U>(UnsafeList<T>, U)
    UnsafeListExtensions.IndexOf<T, U>(UnsafeList<T>, U)
    NativeSortExtension.BinarySearch<T, U>(UnsafeList<T>, T, U)
    NativeSortExtension.SortJob<T, U>(UnsafeList<T>, U)
    NativeSortExtension.Sort<T, U>(UnsafeList<T>, U)
    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)