- Home /
Animator not animating a runtime instantiated child
I have a GameObject representing a room. As childs of this room I have 3 characters. Room has an animator component that control the synchronized animation of all characters.
The problem is I have another character that is instantiate from a prefab at runtime and this doesn't animate.
I tried several things:
//NOT WORKING
IEnumerator Start()
{
room.SetBool("e8", true);
}
//NOT WORKING
IEnumerator Start()
{
room.Rebind();
room.SetBool("e8", true);
}
//WORKING
IEnumerator Start()
{
yield return new WaitForEndOfFrame();
room.Rebind();
room.SetBool("e8", true);
}
The last try is working but the character looks stopped for an instant and suddenly jumps to the animation. I want the character animating from the beginning like the other characters.
Well, you just saved with
yield return new WaitForEndOfFrame(); room.Rebind();
I didn't know I needed to wait for the next frame to rebind, rebinding right after instantiating the model wasn't working.
Your answer
Follow this Question
Related Questions
Attaching a child object to a parent object that animates it in runtime 0 Answers
Runtime instantiated prefab doesn't animate 3 Answers
Prefab animation only plays on first instance 1 Answer
Animation questions (newbie) 1 Answer
Setting animator parameter on a single instance of a prefab sets the parameter for all instances 3 Answers