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