Constant errors and warnings when destroying\disabling gameobjects inside a tween's OnKill\OnComplete

Hi all,
I’m using a lot of DOTween for some simple animations\sound management, and I usually want to disable or destroy the game object running the tween when the tween finishes, for instance, imagine a hit sequence where something scales down to zero over X amount of time, using do tween. Once the tween completes, I want to return that object to the poll. All is well, but when there are a lot of objects doing that, my console gets clogged up with “The object of type ‘X’ has been destroyed but you are still trying to access it.”
This sometimes causes objects to not be destroyed\disabled, which is also pretty bad.

Any idea on how to deal with this? What are the best practices?

Thanks

Please only use the 2D tag when you’re asking about 2D features otherwise this appears in the 2D product area and it’s unrelated.

This is a scripting question. I’ll update the tags.

Thanks.

1 Like