Extensions
An extension methods for Unity
Extension Method is a very important function in c#. This is a start point of Functional Programming in c#.
<source>
Array
int[] data = { 0, 1, 2, 3, 4, 5 };
// swap 2 elements in array
data.SwapElements(2, 5); // output 0, 1, 5, 3, 4, 2Bounds
// get random point in Bounds object
Vector3 randomPoint = myBound.RandomPoint();byte
byte b = 16;
// convert to volume formatted string
var size = b.SizeSuffix(2) // size = "16 bytes"
// convert to Currency formatted string
var amount = b.CurrencySuffix(2) // amount = "16"Color
DateTime
Dictionary
float
IEnumerable
int
LayerMask
long
Mathmatics.float2
Mathmatics.float3
Mathmatics.float4
Mathematics.quaternion
Quaternion
RectTransform
short
string
Texture2D
Transform
CopyDataFrom with scale may cause error because scale is local space.
It's recommended to set the localscale if scale is not 1.
Vector2
Vector2Int
Vector3
Vector3Int
Vector4
Last updated