Sign(float)
Returns the sign of f.
Read time 1 minuteLast updated 6 days ago
Definition
- Type: Method
- Namespace: UnityEngine
- Assembly: UnityEngine.CoreModule
public static float Sign(float f)
Parameters
Returns
Type | Description |
|---|---|
| float |
Remarks
Returns a value of 1 when f is 0 or greater. Returns a value of -1 when f is negative.
Examples
using UnityEngine;public class Example : MonoBehaviour{ void Start() { Debug.Log(Mathf.Sign(-10)); Debug.Log(Mathf.Sign(10)); }}