How to start coroutine, after object is destroyed.
Consider Destroy()-ed objects out of the game. Don’t try to do anything with them, it is almost certainly going to end badly, even if you transiently get something working.
Instead, try to simplify your question to the point where it is answerable by strangers. This is an excellent format to try:
This is the bare minimum of information to report:
- what you want
- what you tried
- what you expected to happen
- what actually happened, log output, variable values, and especially any errors you see
- links to actual Unity3D documentation you used to cross-check your work (CRITICAL!!!)
The purpose of YOU providing links is to make our job easier, while simultaneously showing us that you actually put effort into the process. If you haven’t put effort into finding the documentation, why should we bother putting effort into replying?
How to create event, that will be triggered after object is destroyed.
MonoBehaviours have an OnDestroy() method and they also have an OnDisable() method.
If this sounds unfamiliar, hurry to the official Unity3D documentation for example code.
I recommend doing things with OnDisable() as there are more rough edges to worry about with OnDestroy().
I need to start coroutine on Destroy. And it doesnt let me, if object destroyed.
I think i found a solution, but how do i make it if 1 of objects is destroyed.