An extension method for Assert.AreApproximatelyEqual.
#pragma strict public class AssertionExampleClass extends MonoBehaviour { function Update() { //Unless specified, default error tolerance will be used. transform.position.x.MustBeApproximatelyEqual(0.0f); transform.position.y.MustBeApproximatelyEqual(0.0f); transform.position.z.MustBeApproximatelyEqual(0.0f); } }
public class AssertionExampleClass : MonoBehaviour { void Update () { //Make sure the position of the GameObject is always in the center of the scene. //MustBeApproximatelyEqual should be used for comparing floating point variables. //Unless specified, default error tolerance will be used. transform.position.x.MustBeApproximatelyEqual(0.0f); transform.position.y.MustBeApproximatelyEqual(0.0f); transform.position.z.MustBeApproximatelyEqual(0.0f); } }