Assert クラスには、コード上に不変条件を設定するためのアサーションメソッドに含まれています。
All method calls will be conditionally included only in the development
      builds, unless explicitly specified (see BuildOptions.ForceEnableAssertions).
      The inclusion of the assertions is controlled by UNITY_ASSERTIONS define.
      A failure of an assertion method does not break the control flow of the execution.
      On a failure, an assertion message is logged (LogType.Assert) and the execution
      continues. If Assert.raiseExceptions is set to true, an AssertionException
      is thrown instead of logging a message.
      If a debugger is attached to the project (System.Diagnostics.Debugger.IsAttached is true),
      AssertionException will be thrown in order to pause the excecution and
      invoke the debugger. 
using UnityEngine; using UnityEngine.Assertions;
public class AssertionExampleClass : MonoBehaviour { public int health; public GameObject go;
void Update() { // You expect the health never to be equal to zero Assert.AreNotEqual(0, health);
// The referenced GameObject should be always (in every frame) be active Assert.IsTrue(go.activeInHierarchy); } }
| raiseExceptions | エラーについては、例外をスローします。 | 
| AreApproximatelyEqual | 値がほぼ等しいアサート。絶対誤差の確認は、ほぼ正確な等価の確認に使用されます( |a-b|<tolerance )。デフォルトの許容誤差は、0.00001f です。注記:指定された許容範囲でメソッドを呼出すたびに、新しい FloatComparer のインスタンスが作成されます。パフォーマンス上の理由により、2つのオブジェクトが等しいインスタンスかどうか比較したい場合は、AreEqual メソッドで行ってください。許容値が指定されていない場合、デフォルトの Comparer が使われ問題は発生しません。 | 
| AreEqual | 値が等しいアサート。comparer が指定されない場合、EqualityComparer<T>.デフォルトが使用されます。 | 
| AreNotApproximatelyEqual | 値が近似的に等価でないアサート。絶対誤差の確認は、ほぼ正確な等価の確認に使用されます( |a-b|<tolerance )。デフォルトの許容誤差は、0.00001f です。 | 
| AreNotEqual | 値が等しくないアサート | 
| IsFalse | false となる条件のアサート | 
| IsNotNull | 値が null でないアサート | 
| IsNull | 値が null であるアサート | 
| IsTrue | true となる条件のアサート |