Parameter | Description |
---|---|
a | First value to compare. |
b | Second value to compare. |
values | Array of values to compare. |
float Smallest value found between all compared values.
Returns the minimum of two or more values.
The resulting value will be the input value closest to '-Mathf.Infinity'.
Additional resources: Max.
using UnityEngine;
public class ScriptExample : MonoBehaviour { void Start() { // Prints 0 Debug.Log(Mathf.Min(0, Mathf.Infinity)); // Prints -Inifnity Debug.Log(Mathf.Min(0, -Mathf.Infinity)); // Prints -Infinity Debug.Log(Mathf.Min(-Mathf.Infinity, Mathf.Infinity)); // Prints -1 Debug.Log(Mathf.Min(0, 1, 5, -1, 8, 10)); } }
Parameter | Description |
---|---|
a | First value to compare. |
b | Second value to compare. |
values | Array of values to compare. |
int Smallest value found between all compared values.
Returns the minimum of two or more values.
The resulting value will be the input value closest to 'int.MinValue'.
Additional resources: Max.
using UnityEngine;
public class ScriptExample : MonoBehaviour { void Start() { // Prints 0 Debug.Log(Mathf.Min(0, int.MaxValue)); // Prints -2147483648 Debug.Log(Mathf.Min(0, int.MinValue)); // Prints -2147483648 Debug.Log(Mathf.Min(int.MinValue, int.MaxValue)); // Prints -1 Debug.Log(Mathf.Min(0, 1, 5, -1, 8, 10)); } }