Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


SortJob

Returns a job which will sort an array in ascending order.
Read time 6 minutesLast updated 13 days ago

Definition

  • Type: Method
  • Namespace: Unity.Collections
  • Assembly: UnityEngine.ManagedKernelModule

SortJob<T>(`<>*, int)

Returns a job which will sort an array in ascending order.
public static SortJob<T, NativeSortExtension.DefaultComparer<T>> SortJob<T>(T* ptr, int length) where T : unmanaged, IComparable<T>

Parameters

ptr

The array to sort.

length

The number of elements to sort in the array. Indexes greater than or equal to
length
won't be included in the sort.

Returns

Type

Description

SortJob<T, DefaultComparer<T>>A job for sorting the array.

Remarks

This method does not schedule the job. Scheduling the job is left to you.

SortJob<T, U>(`<>*, int, T)

Returns a job which will sort an array using a custom comparison.
public static SortJob<T, U> SortJob<T, U>(T* ptr, int length, U comp) where T : unmanaged where U : IComparer<T>

Parameters

ptr

The array to sort.

length

The number of elements to sort in the array. Indexes greater than or equal to
length
won't be included in the sort.

comp

T
The comparison function used to determine the relative order of the elements.

Returns

Type

Description

SortJob<T, T>A job for sorting the array.

Remarks

This method does not schedule the job. Scheduling the job is left to you.

SortJob<T>(Span<T>)

Returns a job which will sort this span in ascending order.
public static SortJob<T, NativeSortExtension.DefaultComparer<T>> SortJob<T>(this Span<T> span) where T : unmanaged, IComparable<T>

Parameters

The span to sort.

Returns

Type

Description

SortJob<T, DefaultComparer<T>>A job for sorting this array.

Remarks

This method does not schedule the job. Scheduling the job is left to you.

SortJob<T, U>(Span<T>, T)

Returns a job which will sort this span using a custom comparison.
public static SortJob<T, U> SortJob<T, U>(this Span<T> span, U comp) where T : unmanaged where U : IComparer<T>

Parameters

The span to sort.

comp

T
The comparison function used to determine the relative order of the elements.

Returns

Type

Description

SortJob<T, T>A job for sorting the array.

Remarks

This method does not schedule the job. Scheduling the job is left to you.

SortJob<T>(NativeArray<T>)

Returns a job which will sort this array in ascending order.
public static SortJob<T, NativeSortExtension.DefaultComparer<T>> SortJob<T>(this NativeArray<T> container) where T : unmanaged, IComparable<T>

Parameters

The array to sort.

Returns

Type

Description

SortJob<T, DefaultComparer<T>>A job for sorting this array.

Remarks

This method does not schedule the job. Scheduling the job is left to you.

SortJob<T, U>(NativeArray<T>, T)

Returns a job which will sort this array using a custom comparison.
public static SortJob<T, U> SortJob<T, U>(this NativeArray<T> container, U comp) where T : unmanaged where U : IComparer<T>

Parameters

The array to sort.

comp

T
The comparison function used to determine the relative order of the elements.

Returns

Type

Description

SortJob<T, T>A job for sorting the array.

Remarks

This method does not schedule the job. Scheduling the job is left to you.

SortJob<T>(NativeList<T>)

Returns a job which will sort this list in ascending order.
public static SortJob<T, NativeSortExtension.DefaultComparer<T>> SortJob<T>(this NativeList<T> container) where T : unmanaged, IComparable<T>

Parameters

container

The list to sort.

Returns

Type

Description

SortJob<T, DefaultComparer<T>>A job for sorting this list.

Remarks

When
NativeList.Length
is not known at scheduling time use
SortJobDefer
instead. This method does not schedule the job. Scheduling the job is left to you.

SortJob<T, U>(NativeList<T>, T)

Returns a job which will sort this list using a custom comparison.
public static SortJob<T, U> SortJob<T, U>(this NativeList<T> container, U comp) where T : unmanaged where U : IComparer<T>

Parameters

container

The list to sort.

comp

T
The comparison function used to determine the relative order of the elements.

Returns

Type

Description

SortJob<T, T>A job for sorting this list.

Remarks

When
NativeList.Length
is not known at scheduling time use
SortJobDefer
instead. This method does not schedule the job. Scheduling the job is left to you.

SortJob<T>(UnsafeList<T>)

Returns a job which will sort this list in ascending order.
public static SortJob<T, NativeSortExtension.DefaultComparer<T>> SortJob<T>(this UnsafeList<T> container) where T : unmanaged, IComparable<T>

Parameters

container

The list to sort.

Returns

Type

Description

SortJob<T, DefaultComparer<T>>A job for sorting this list.

Remarks

This method does not schedule the job. Scheduling the job is left to you.

SortJob<T, U>(UnsafeList<T>, T)

Returns a job which will sort this list using a custom comparison.
public static SortJob<T, U> SortJob<T, U>(this UnsafeList<T> container, U comp) where T : unmanaged where U : IComparer<T>

Parameters

container

The list to sort.

comp

T
The comparison function used to determine the relative order of the elements.

Returns

Type

Description

SortJob<T, T>A job for sorting this list.

Remarks

This method does not schedule the job. Scheduling the job is left to you.

SortJob<T>(NativeSlice<T>)

Returns a job which will sort this slice in ascending order.
public static SortJob<T, NativeSortExtension.DefaultComparer<T>> SortJob<T>(this NativeSlice<T> container) where T : unmanaged, IComparable<T>

Parameters

The slice to sort.

Returns

Type

Description

SortJob<T, DefaultComparer<T>>A job for sorting this slice.

Remarks

This method does not schedule the job. Scheduling the job is left to you.

SortJob<T, U>(NativeSlice<T>, T)

Returns a job which will sort this slice using a custom comparison.
public static SortJob<T, U> SortJob<T, U>(this NativeSlice<T> container, U comp) where T : unmanaged where U : IComparer<T>

Parameters

The slice to sort.

comp

T
The comparison function used to determine the relative order of the elements.

Returns

Type

Description

SortJob<T, T>A job for sorting this slice.

Remarks

This method does not schedule the job. Scheduling the job is left to you.