mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
Mathd.Clamp for Unity 2020 support
This commit is contained in:
parent
53658a5886
commit
cae12a43fc
@ -5,6 +5,16 @@ namespace Mirror
|
||||
{
|
||||
public static class Mathd
|
||||
{
|
||||
// Unity 2020 doesn't have Math.Clamp yet.
|
||||
/// <summary>Clamps value between 0 and 1 and returns value.</summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static double Clamp(double value, double min, double max)
|
||||
{
|
||||
if (value < min) return min;
|
||||
if (value > max) return max;
|
||||
return value;
|
||||
}
|
||||
|
||||
/// <summary>Clamps value between 0 and 1 and returns value.</summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static double Clamp01(double value)
|
||||
|
Loading…
Reference in New Issue
Block a user