Access Animation in child


How would I access an animation placed on a child object that I don’t know the name of the child object ?

The reason I don’t know the name is that the child object will be changed through the game with different objects but all with the same named animations but tailored to that object.

If that makes sense …


If only one of the children has an animation component, you can use GetComponentInChildren. If not, you’ll need something smarter. I’d say, when the child is parented, make himself known to the parent.