文档

Unity Engine

Unity Engine

CeilToInt(float)

Returns the smallest integer greater to or equal to f.
阅读时间1 分钟最后更新于 1 天前

Definition

public static int CeilToInt(float f)

Parameters

Returns

Type

Description

int

Examples

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)); }}