Question by
Jarff · Oct 11, 2016 at 04:13 PM ·
scripting problemanimatorgetcomponentinchildren
GetComponentsInChildren(); Not working
Hello everyone i'm trying to get avatar from a child but it's not working and i don't know why. Here is my code
function SetupAnimator()
{
anim = GetComponent("Animator");
var hingeJoints : Animator[];
hingeJoints = GetComponentsInChildren.<Animator>();
for (var childAnimator : Animator in hingeJoints ){
anim.avatar = childAnimator.avatar;
}
}

i'm calling this function in fuction Start(){} This function SetupAnimator() is attached to Player The solider children has an animator component.
There is no error but isn't working.
hr.png
(9.3 kB)
Comment
Your answer