Skip to content

Instantly share code, notes, and snippets.

@todorok1 todorok1/RangeCheck_04.cs
Last active Jun 13, 2018

Embed
What would you like to do?
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
You can’t perform that action at this time.