UnityEngine.Object
并不是真正的C#对象,并非引用后就可以一直使用了,如果有外部释放的可能性,需要在使用前判空。
另外不要继承 UnityEngine.Object
, 判空是不正确的,
参考
- Forums > Unity Community Support > UnityEngine.Object
-
Playmaker Forum » Playmaker Help & Tips » Playmaker Help » Making custom FsmObject types?
WARNING: Unity.Object do not obey garbage collections, they only get cleaned up if you call manually Resources.UnloadUnusedAssets() else on mobile you might get to a memory crash eventually if you use a lot of these.