- Home /
How to fully reset mecanim?
I have a pool of enemies so I can recycle them, when an enemy goes out of sight I disable its animator controller, the GameObject remains enabled is just the animator controller what I'm disabling. Each enemy has a default animation which must be played every time it's respawned and each animator controller has a "Restart" trigger, so the respawing process consist only in placing the enemy at the right position and set the "Restart" trigger.
This works fine 99% of the times, however I'm having 2 problems and think the only solution is to make a fully reset mecanim, but do't know how.
First Problem:
The enemies have a "Die" animation that is played when they are destroyed, once they go out of sight the "Restart" trigger makes sure they are respawned "a life", however once in a while the are respawned "dead", so this means the "Restart" trigger is not working 100% of the times.
Second Problem:
One of the enemies have two children each one whit it's own animator controller, in this case when the enemy dies I'm disabling both childern's GameObjects, when this enemy is respawned more than 2 times, one of the children's animation starts playing BACKWARDS!. I checked it with the debugger and every time the animation plays backwards; speed equals 1 (positive one), but if I remove all the instructions that call SetActive the animation plays always forward, so this is weird.
Your answer
![](https://koobas.hobune.stream/wayback/20220612041036im_/https://answers.unity.com/themes/thub/images/avi.jpg)