Legacy Documentation: Version 5.5
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Mathf.Floor

public static float Floor(float f);

Description

Returns the largest integer smaller to or equal to f.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void Example() { Debug.Log(Mathf.Floor(10.0F)); Debug.Log(Mathf.Floor(10.2F)); Debug.Log(Mathf.Floor(10.7F)); Debug.Log(Mathf.Floor(-10.0F)); Debug.Log(Mathf.Floor(-10.2F)); Debug.Log(Mathf.Floor(-10.7F)); } }