Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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