Legacy Documentation: Version 4.5.0

Script language:

  • JS
  • C#
  • Boo
Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Mathf.Max

static function Max(a: float, b: float): float;
static float Max(float a, float b);
static def Max(a as float, b as float) as float
static function Max(params values: float[]): float;
static float Max(params float[] values);
static def Max(*values as float[]) as float

Description

Returns largest of two or more values.

	// prints 2.4
	print(Mathf.Max(1.2, 2.4));
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    void Example() {
        print(Mathf.Max(1.2F, 2.4F));
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	def Example() as void:
		print(Mathf.Max(1.2F, 2.4F))

static function Max(a: int, b: int): int;
static int Max(int a, int b);
static def Max(a as int, b as int) as int
static function Max(params values: int[]): int;
static int Max(params int[] values);
static def Max(*values as int[]) as int

Description

Returns the largest of two or more values.

	// prints 2
	print(Mathf.Max(1, 2));
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    void Example() {
        print(Mathf.Max(1, 2));
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	def Example() as void:
		print(Mathf.Max(1, 2))