The object of type 'Image' has been destroyed but you are still trying to access it. Your script sho

So I have a pretty nasty exception that pops up at random times in my game. Not sure the cause as the stack trace is limmited to methods inside of Unity. The exception is followed by a lockup of the UI (mouse / touch stop working) as the exception spams itself.

I have submitted a rather large bug report (as I was unable to replicate the error in a reduced project). I was wondering if anyone else has run into this issue or something similar.

Case 644085

1 Like

I just updated to 4.6b21 and am now seeing this error, which seems to spam every update from the EventSystem. Going to revert back to 4.6b20 since it is blocking, but it would be nice to get more information on why it occurs.

It also blocks all input events in my game, as the OP mentioned

1 Like

I reverted back to b20. It did not help. Whatever was updated when I went to b21 persisted when I downgraded.

Huh … my downgrade did seem to fix things. I did revert the QualitySettings file, which p4connect picked up as a changed file. It didn’t appear to have any deltas when I glanced at it, though I might have missed something.

Thanks for submitting the report. Unity guys (if you read this): let me know if you want anything from me in regard to the bug.

I have exacly the same issue. Tell me if you need anything too, I will watch this post.

(I made a duplicate by mistake uGui 4.6.0.21b: The object of type 'Image' has been destroyed but you are still trying to access it - Unity Engine - Unity Discussions just saw this post after)

I can’t downgrade to 20b as I have the ā€œScene not loading and making unity crash with memory issueā€ bug.
Do you have any other suggestion as a workaround for now?

Same issue here. In my case it is when I return to my starting scene efter playing in the main scene. Working in b20. If anyone needs details let me know

1 Like

Got this error in b21. It is fired after i destroy my old objects. I thought i had to remove some event listeners OnDestroy but failed to fix it till now.

I’ve managed to deal with it using .SetActive and something like object pool

Somehow I fixed my issue, I think it might have had something to do with UI components that were disabled during startup but I’m not sure and now I can’t reproduce

1 Like

Seems like fixed in 4.6 rc1. Returned some my code from gameobject.SetActive to Destroy and no errors.

1 Like

Yeah, works for me too

Yep, updating to 4.6.0f1 (RC1) also solved it in my case.

I had same issue in b21, but I fixed it. It seems like you call to GameObject.SetActive(false) in Awake(). Don’t use SetActive(false) in Awake(). Maybe it works. :slight_smile:

Have you tested in the U5 beta? I’m getting these errors in U5 now.

I was getting this error as well, but eventually figured out my problem:

I am using delegates and events in the project. I was adding objects to listen for certain Events -
void Start () {
EventManager.OnEvent += SomeMethod;
}

But I failed to remove the objects from listening to Events -
void OnDisable () {
EventManager.OnEvent -= SomeMethod;
}

Noob mistake on my part, but it might be helpful to others.

9 Likes

We’re seeing this exception in 4.6.2f1. One way to trigger it is to tap away from Unity to lose focus, then tap on the game window again to regain focus, which spams the exception. We have no idea why.

I think i found the problem, boys !!
Something similar happened to me:

ā€œMissingReferenceException: The object of type __ has been destroyed but you are still trying to access it. Your script should either check if it is null or you should not destroy the object.ā€

i had this for an hour trying to get rid of it by disabling every script and game object. i finally realised it was because I had a second inspector window locked (upper right icon) so I could set some variables in the inspector. When I unlocked it, this error went away. (ps. this error CAN be reproduced … and I am using unity 5.2.1)

Hope this helps someone else to not lose their mind :slight_smile:

2 Likes

This totally fixed it! Thank you :smile:

@HoldShort-21
Yeah I made the same mistake and now got it working after 2 hours, all thanks to you!

Work For Me Thank you so much!

I searched and found my log in just to thank you.

Also my noob mistake. Regards.