UnityVecExtensions
Namespace: Shadop.Archmage.Sdk
Extension methods for Vec2, Vec3, and Vec4.
public static class UnityVecExtensionsInheritance Object → UnityVecExtensions
Supported Types
Section titled “Supported Types”To maximize performance and avoid garbage collection (GC) allocations in Unity, these extensions provide explicit, hardcoded overloads for standard numeric types.
The underlying generic type T can be one of the following:
- Integer Types:
byte,sbyte,short,ushort,int,uint,long,ulong - Floating-point Types:
float,double
Note: The documentation below uses a generic syntax <T> for brevity, but the actual implementation uses explicit overloads for the types listed above.
Methods
Section titled “Methods”ToVector2(Vec2<T>)
Section titled “ToVector2(Vec2<T>)”Converts a floating-point Vec2 to a UnityEngine.Vector2. Supported for float and double.
public static Vector2 ToVector2(this Vec2<T> vec)Returns
Section titled “Returns”ToVector2Int(Vec2<T>)
Section titled “ToVector2Int(Vec2<T>)”Converts an integer Vec2 to a UnityEngine.Vector2Int. Supported for byte, sbyte, short, ushort, int, uint, long, and ulong.
public static Vector2Int ToVector2Int(this Vec2<T> vec)Returns
Section titled “Returns”ToVector3(Vec3<T>)
Section titled “ToVector3(Vec3<T>)”Converts a floating-point Vec3 to a UnityEngine.Vector3. Supported for float and double.
public static Vector3 ToVector3(this Vec3<T> vec)Returns
Section titled “Returns”ToVector3Int(Vec3<T>)
Section titled “ToVector3Int(Vec3<T>)”Converts an integer Vec3 to a UnityEngine.Vector3Int. Supported for byte, sbyte, short, ushort, int, uint, long, and ulong.
public static Vector3Int ToVector3Int(this Vec3<T> vec)Returns
Section titled “Returns”ToVector4(Vec4<T>)
Section titled “ToVector4(Vec4<T>)”Converts a Vec4 to a UnityEngine.Vector4. Because Unity does not have a standard Vector4Int type, this method is supported for all numeric types (both integer and floating-point).
public static Vector4 ToVector4(this Vec4<T> vec)