Version: 2017.1

Assert.AreNotApproximatelyEqual

マニュアルに切り替える
public static void AreNotApproximatelyEqual (float expected, float actual);
public static void AreNotApproximatelyEqual (float expected, float actual, string message);
public static void AreNotApproximatelyEqual (float expected, float actual, float tolerance);
public static void AreNotApproximatelyEqual (float expected, float actual, float tolerance, string message);

パラメーター

tolerance 近似の許容誤差

説明

値が近似的に等価でないアサート。絶対誤差の確認は、ほぼ正確な等価の確認に使用されます( |a-b|<tolerance )。デフォルトの許容誤差は、0.00001f です。

using UnityEngine;
using UnityEngine.Assertions;

public class AssertionExampleClass : MonoBehaviour { Rigidbody rb; void Update() { //Make sure the rigidbody never stops. //AreNotApproximatelyEqual should be used for comparing floating point variables. //Unless specified, default error tolerance will be used. Assert.AreNotApproximatelyEqual(0.0f, rb.velocity.magnitude); } }