- Home /
Problems with Animator(Mecanim)
I have a character with Animator(Mecanim) and I want to disable GameObject and enable (with setactive). After I do that, my animations not working. Animator controller is working, states are changing from one to another, but I canot see animations. I googled a little bit, and found answer that: "Activating/deactivating an object free all resources used by this object so this is expected" But is there any solution how to implement disabling and enabling character without problems? Thanks
Answer by meat5000 · Feb 16, 2015 at 09:23 PM
If you re-enable a gameObject you will need to manually re-run all the Start() methods on the scripts contained on the object, as Start only will run 1 time for the entire lifetime of the object.
Try
void OnEnable()
{
Start();
}
in each script.
You could also try a Rebind, but it seems quite specific in its context.