Skip to content

Instantly share code, notes, and snippets.

@todorok1
Created July 3, 2018 07:23
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save todorok1/8820ba5591895f6cd6ba35baa408ac38 to your computer and use it in GitHub Desktop.
MathfのCeilを使った時の動作
public class MathfCheck : MonoBehaviour {
void Start(){
CeilTest();
}
void CeilTest(){
float value = 7.65f;
Debug.Log("value : " + value + " / Ceil : " + Mathf.Ceil(value));
Debug.Log("value : " + value + " / CeilToInt : " + Mathf.CeilToInt(value));
value = -8.76f;
Debug.Log("value : " + value + " / Ceil : " + Mathf.Ceil(value));
Debug.Log("value : " + value + " / CeilToInt : " + Mathf.CeilToInt(value));
float ceiledValue = Mathf.Ceil(value);
// 明示的にキャストが必要
int ceildIntValue = (int) Mathf.Ceil(value);
float ceiledToIntValueToFloat = Mathf.CeilToInt(value);
int ceiledToIntValueToInt = Mathf.CeilToInt(value);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment