- Home /
Attaching a child object to a parent object that animates it in runtime
I have an object with an animator that animates a series of children, including one that I wish to instantiate and attach to it in runtime.
My workflow for this was:
Create the child object on the bone of the parent object.
Animate it through the parent object's animations.
Create a prefab out of the child object and remove it from the parent.
At runtime, I instantiate the child object with the same name it had in the parent's hierarchy and attach it to the correct bone.
Observing the parent's animator, no missing reference is detected.
The child object is correctly positioned and the hierarchy is correct.
However, even if I am animating its scale, turning on and off its skinned mesh renderer, nothing seems to happen.
If, while the game is running, I ran one of the animations that affect this child object through the Editor, it plays correctly and from then on everything seems to be fine. It looks as if some references are fixed or something like that.
Is there anything I am missing here?
Your answer
![](https://koobas.hobune.stream/wayback/20220612224639im_/https://answers.unity.com/themes/thub/images/avi.jpg)