Version: 2017.3
public static float Infinity ;

描述

正无穷大的表示形式(只读)。

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