Version: 5.6

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 です。

public class AssertionExampleClass : MonoBehaviour
{
    Rigidbody rigidbody;
    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, rigidbody.velocity.magnitude);
    }
}