Sign(float)
Returns the sign of f.
阅读时间1 分钟最后更新于 1 个月前
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)); }}