unity API中assert类下的函数作用简介解释

/官方例子
//assert为强调,比如Assert.AreNotEqual(0,XXX)XXX一定不等于0,Assert.IsTrue(XXX!=null)XXX一定为真
using UnityEngine;
using UnityEngine.Assertions;
public class ExampleClass : MonoBehaviour
{
    public int health;
    public GameObject go;
    void Update()
    {
        //如果你想生命值不等于0
        Assert.AreNotEqual(0, health);
        //游戏对象一直在每一帧都存在
        Assert.IsTrue(go.activeInHierarchy);
    }
}
/*函数:作用与字面意思
AreApproximatelyEqual
AreEqual
AreNotApproximatelyEqual
AreNotEqual
IsFalse
IsNotNull
IsNull
IsTrue
*/

你可能感兴趣的:(unity)