- Home /
How to reset entire animator and gameobject
Hi, I have a little problem.
So I made a pool system of gameobjects that I use during all the game and basically here is how it works : I instantiate X gameobjects at the beginning with a "NotUsed" state. When I need one, I set its state to "Used" and display it in the scene until I deactivate it and reset its state to "NotUsed". Every gameobject has its own animator and its life cycle is something like this : spawn -> move -> explode.
Now here is the problem, when the object explodes, the animation makes it go transparent. After this animation ends, I deactivate the entire gameobject and reset its state BUT when I want to use it again by reactivating it, the animator is reseted but the object keeps its transparency like at the end of the exploding animation.
It's like by deactivating the gameobject during an animation, the object saves the state it's in. I don't know if you understand what I mean. The only way I found to "fix" this problem is not to deactivating the gameobject but that means having all the rigidbodies and animators doing their thing even if the object is not on the screen.
I tried to find a way to reset/stop the animator to make the gameobject go to it's default pose before disabling it (like without an animator) but by disabling the animator, the pose is the one it was when I paused the animation, so not reseted, more like freezed.
Is there a way to do what I want ? Or maybe another solution for this problem ...
Your answer
Follow this Question
Related Questions
Object's sprite and collider are not at same position as transform 1 Answer
Animation Change after changing pixel 0 Answers
Animation copy 1 Answer
Animator - Do After Playing Animation 1 Answer
Problems with Animator(Mecanim) 1 Answer