public static bool Approximately(float a, float b);
判断两个float型是否近似相等。
示例
using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour
{
void Start()
{
float a = 1.0f;
float b = 10.00001f / 10.0f;
Debug.Log("a="+a);
Debug.Log("b="+b);
Debug.Log(a == b);
//判断两个float型是否近似相等
Debug.Log(Mathf.Approximately(a, b));
}
}
输出