Mathf.Abs

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)); } }

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)); } }
对文档有任何疑问,请移步至开发者社区提问,我们将尽快为您解答