Legacy Documentation: Version 5.4
LanguageEnglish
  • C#
  • JS

Script language

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

Mathf.Infinity

public static float Infinity;

Description

A representation of positive infinity (Read Only).

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void Update() { Debug.DrawLine(Vector3.zero, Vector3.forward * 100); if (Physics.Raycast(Vector3.zero, Vector3.forward, Mathf.Infinity)) print("There is something in front of the object!"); } }