Version: 2020.1
public static int CeilToInt (float f);

描述

返回大于或等于 f 的最小整数。

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void Start() { // Prints 10 Debug.Log(Mathf.CeilToInt(10.0f)); // Prints 11 Debug.Log(Mathf.CeilToInt(10.2f)); // Prints 11 Debug.Log(Mathf.CeilToInt(10.7f));

// Prints -10 Debug.Log(Mathf.CeilToInt(-10.0f)); // Prints -10 Debug.Log(Mathf.CeilToInt(-10.2f)); // Prints -10 Debug.Log(Mathf.CeilToInt(-10.7f)); } }