Legacy Documentation: Version 2018.2 (Go to current version)
LanguageEnglish
  • C#

Mathf.Ceil

public static float Ceil(float f);

Description

Returns the smallest integer greater to or equal to f.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void Example() { // Prints 10 Debug.Log(Mathf.Ceil(10.0F)); // Prints 11 Debug.Log(Mathf.Ceil(10.2F)); // Prints 11 Debug.Log(Mathf.Ceil(10.7F)); // Prints -10 Debug.Log(Mathf.Ceil(-10.0F)); // Prints -10 Debug.Log(Mathf.Ceil(-10.2F)); // Prints -10 Debug.Log(Mathf.Ceil(-10.7F)); } }
对文档有任何疑问,请移步至开发者社区提问,我们将尽快为您解答