C#中,某些类型会定义隐式类型转换和操作符重载。Unity中,有些对象也定义了隐式类型转换和操作符重载。典型情况有:UnityEngine.Object。UnityEngine.Object的销毁是调用 Destory。被调用过Destory的对象,并不是真的变成null了,但是再对它操作会导致异常。
Unity重载了UnityEngine.Object "==","!="操作符,和 implicit 转换。
public static bool operator ==(Object x, Object y); public static bool operator !=(Object x, Object y); public static implicit operator bool(Object exists);