在使用Interface,并且由Monobehaviour继承Interface情况下,判断 interface的实际UnityEngine.Object是否null,出现错误,没有成功的判断出已经Destroy
https://gamedev.stackexchange.com/questions/128971/unity-c-interface-object-never-equals-null
解决方案:
https://discussions.unity.com/t/destroyed-object-not-comparing-to-null/88287
MonoBehaviour == operator is not overriden - it’s Object == operator. But I see that Equals
method is overriden
shootTarget == null || shootTarget.Equals(null)
原因:
shootTarget.Equals(null)实际调用的是UnityEngine.Object内复写的Equals,可以检测到UnityObject是否被Destroy
标签:Object,Equals,shootTarget,unity,interface,null From: https://www.cnblogs.com/sun-shadow/p/17086238.html