Version: Unity 6.7 Beta (6000.7)
LanguageEnglish
  • C#

UnsafeList<T0>

struct in Unity.Collections.LowLevel.Unsafe


Implements interfaces:IIndexable<T0>, INativeDisposable, INativeList<T0>

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

An unmanaged, resizable list.

Static Properties

Property Description
MaxCapacity The maximum number of elements this type of container can hold.

Properties

Property Description
Allocator The allocator used to create the internal buffer.
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.
Length The number of elements.
m_capacity The number of elements that can fit in the internal buffer.
m_length The number of elements.
Ptr The internal buffer of this list.
this[int] The element at an index.

Constructors

Constructor Description
UnsafeList_1 Initializes and returns an instance of UnsafeList.

Public Methods

Method Description
Add Adds an element to the end of the list.
AddNoResize Adds an element to the end of this list.
AddRange Copies the elements of a buffer to the end of this list.
AddRangeNoResize Copies elements from a buffer to the end of this list.
AddReplicate Appends value count times to the end of this list.
AsParallelReader Obsolete. Use UnsafeList<T0>.AsReadOnly instead.
AsParallelWriter Returns a parallel writer of this list.
AsReadOnly Returns a read only of this list.
AsReadOnlySpan Returns ReadOnlySpan<T> view of this container.
AsSpan Returns Span<T> view of this container.
Clear Sets the length to 0.
CopyFrom Copies all elements of specified container to this container.
Dispose Releases all resources (memory).
ElementAt Returns a reference to the element at a given index.
GetEnumerator Returns an enumerator over the elements of the list.
GetUnsafePtr Get a pointer to the data.
GetUnsafeReadOnlyPtr Get a pointer to the data.
InsertRange Shifts elements toward the end of this list, increasing its length.
InsertRangeWithBeginEnd Shifts elements toward the end of this list, increasing its length.
RemoveAt Removes the element at an index, shifting everything above it down by one. Decrements the length by 1.
RemoveAtSwapBack Copies the last element of this list to the specified index. Decrements the length by 1.
RemoveRange Removes "N" elements in a range, shifting everything above the range down by "N". Decrements the length by "N".
RemoveRangeSwapBack Copies the last "N" elements of this list to a range in this list. Decrements the length by "N".
Resize Sets the length, expanding the capacity if necessary.
SetCapacity Sets the capacity.
TrimExcess Sets the capacity to match the length.

Static Methods

Method Description
Create Returns a new list.
Destroy Destroys the list.

Operators

Operator Description
ReadOnlySpan<T> Implicit cast to ReadOnlySpan<T>.
Span<T> Implicit cast to Span<T>.