Table of Contents

Class Polyfills

Polyfills for compatibility with older versions of Unity and .NET.

public static class Polyfills
Inheritance
Polyfills
Inherited Members

Methods

Contains(string, string, StringComparison)

(Added in .NET Standard 2.1) Check if the string contains the specified value.

public static bool Contains(this string s, string value, StringComparison comparationType)

Parameters

s string

The string to check.

value string

The value to check.

comparationType StringComparison

The comparison type.

Returns

bool

true if the string contains the value; otherwise, false.

GetLocalPositionAndRotation(Transform, out Vector3, out Quaternion)

(Added in Unity 2021.3) Get the local position and rotation of the transform.

public static void GetLocalPositionAndRotation(this Transform transform, out Vector3 localPosition, out Quaternion localRotation)

Parameters

transform Transform

The transform to get the local position and rotation from.

localPosition Vector3

The local position of the transform.

localRotation Quaternion

The local rotation of the transform.

GetPositionAndRotation(Transform, out Vector3, out Quaternion)

(Added in Unity 2021.3) Get the position and rotation of the transform.

public static void GetPositionAndRotation(this Transform transform, out Vector3 position, out Quaternion rotation)

Parameters

transform Transform

The transform to get the position and rotation from.

position Vector3

The position of the transform.

rotation Quaternion

The rotation of the transform.

SetLocalPositionAndRotation(Transform, Vector3, Quaternion)

(Added in Unity 2021.3) Set the local position and rotation of the transform.

public static void SetLocalPositionAndRotation(this Transform transform, Vector3 localPosition, Quaternion localRotation)

Parameters

transform Transform

The transform to set the local position and rotation to.

localPosition Vector3

The local position to set.

localRotation Quaternion

The local rotation to set.

TryDequeue<T>(Queue<T>, out T)

(Added in .NET Standard 2.1) Try to dequeue an item from the queue.

public static bool TryDequeue<T>(this Queue<T> queue, out T result)

Parameters

queue Queue<T>

The queue to dequeue from.

result T

The dequeued item.

Returns

bool

true if the queue is not empty; otherwise, false.

Type Parameters

T

The type of the item in the queue.

TryPeek<T>(Queue<T>, out T)

(Added in .NET Standard 2.1) Try to peek an item from the queue.

public static bool TryPeek<T>(this Queue<T> queue, out T result)

Parameters

queue Queue<T>

The queue to peek from.

result T

The peeked item.

Returns

bool

true if the queue is not empty; otherwise, false.

Type Parameters

T

The type of the item in the queue.

TryPeek<T>(Stack<T>, out T)

(Added in .NET Standard 2.1) Try to peek an item from the stack.

public static bool TryPeek<T>(this Stack<T> stack, out T result)

Parameters

stack Stack<T>

The stack to peek from.

result T

The peeked item.

Returns

bool

true if the stack is not empty; otherwise, false.

Type Parameters

T

The type of the item in the stack.

TryPop<T>(Stack<T>, out T)

(Added in .NET Standard 2.1) Try to pop an item from the stack.

public static bool TryPop<T>(this Stack<T> stack, out T result)

Parameters

stack Stack<T>

The stack to pop from.

result T

The popped item.

Returns

bool

true if the stack is not empty; otherwise, false.

Type Parameters

T

The type of the item in the stack.