using UnityEngine; public static class IntExtensions { public static float Clamp( this int value, int min, int max ) { return Mathf.Clamp( value, min, max ); } } public static class FloatExtensions { public static float Clamp( this float value, float min, float max ) { return Mathf.Clamp( value, min, max ); } }
int n = 10; n = n.Clamp( 0, 5 );