- Home /
How to get GameObjects used in AnimationClip
How can I, via code, get all the GameObjects that an AnimationClip touches? The Animations in Unity are notoriously fragile and break super easy because they are based on name an hierarchy (instead of GUID), and I am trying to write tools to prevents them from breaking all the time when Artists are iterating on features.
Is there a clean way to get an array of all the GameObjects in an AnimationClip? Similar to the way you can see the list of objects in the Animation window?
i dont really understand what do you mean by gameobjects that an animationclip touuches, all the gameibjects animated with one animation clip? all the objects with an animator implementing that animation clip?
Answer by chor64 · Jun 14, 2020 at 03:31 AM
I think this is a bit late, but for anyone that wants to know the answer, read the unity documentation on AnimationUtility: https://docs.unity3d.com/ScriptReference/AnimationUtility.GetAnimatableBindings.html You can use the GetAnimatableBindings method on each game object to check if it is used in the animation.