Mathf.Abs

Switch to Manual

Declaration

public static float Abs(float f);

Description

Returns the absolute value of f.

using UnityEngine;

public class ScriptExample : MonoBehaviour { void Start() { // prints 10.5 Debug.Log(Mathf.Abs(-10.5f)); } }

Declaration

public static int Abs(int value);

Description

Returns the absolute value of value.

using UnityEngine;

public class MathAbsExample : MonoBehaviour { void Start() { // prints 10 Debug.Log(Mathf.Abs(-10)); } }

Did you find this page useful? Please give it a rating: