Skip to content

Instantly share code, notes, and snippets.

@todorok1
Last active June 13, 2018 09:53
Show Gist options
  • Save todorok1/b2f7a6b6a1dd130cceb74a52b7d2b230 to your computer and use it in GitHub Desktop.
Save todorok1/b2f7a6b6a1dd130cceb74a52b7d2b230 to your computer and use it in GitHub Desktop.
RangeAttributeの使い方あれこれ
[Range(0, Mathf.Infinity)]
public float atk;
[Range(0, Mathf.Infinity)]
public float atkInf;
void Start () {
if (Mathf.Approximately(atk, atkInf)){
Debug.Log("floatの最大値とMathf.Infinityは同じ!");
} else {
Debug.Log("floatの最大値とMathf.Infinityは違うよ!");
}
if (float.IsPositiveInfinity(atk)){
Debug.Log("atkは正の無限大");
} else {
Debug.Log("atkは正の無限大じゃない!");
}
if (float.IsPositiveInfinity(atkInf)){
Debug.Log("atkInfは正の無限大");
} else {
Debug.Log("atkInfは正の無限大じゃない!");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment