I write a callback function in a Component, which will be called by an asynchronous routine when it’s done. The function body is like below:
private void CacheUITexture()
{
if (uiTexture)
{
return;
}
if (gameObject == null || gameObject.transform == null)
{
return;
}
uiTexture = GetComponent<UITexture>();
if (null == uiTexture)
{
Debug.LogError("UIUrlTexture组件缺少UITexture组件");
}
}
However, I found in my android log weired NullException happened in this function body:
But how can this happen? I haved already checked null == gameObject, which will return true when gameObject is destroyed. So I have no idea what may cause this exception, can anyone help?
