Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


FloorToInt(float)

Returns the largest integer smaller to or equal to f.
Read time 1 minuteLast updated 4 days ago

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule
public static int FloorToInt(float f)

Parameters

Returns

Type

Description

int

Examples

using UnityEngine;using System.Collections;public class ExampleClass : MonoBehaviour{ void Example() { Debug.Log(Mathf.FloorToInt(10.0F)); // Prints 10 Debug.Log(Mathf.FloorToInt(10.2F)); // Prints 10 Debug.Log(Mathf.FloorToInt(10.7F)); // Prints 10 Debug.Log(Mathf.FloorToInt(-10.0F)); // Prints -10 Debug.Log(Mathf.FloorToInt(-10.2F)); // Prints -11 Debug.Log(Mathf.FloorToInt(-10.7F)); // Prints -11 }}