Last active
June 13, 2018 09:53
-
-
Save todorok1/b2f7a6b6a1dd130cceb74a52b7d2b230 to your computer and use it in GitHub Desktop.
RangeAttributeの使い方あれこれ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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