Don't Animate Specific Object

Hello Community!

Quick question here! I have an object with many children who are all part of an animation. Does anyone know a method to make it so just one of the children does not animate while the rest do? I know that if you delete an object the animation carries on with no issue but I’d rather not have to delete the object then replace it! I have tried changing the name of the gameobject but this didn’t work, it’s too smart for me!

Thanks in advanced!

Well, the best way I can think to achieve this would be to use an array. I don’t have time to post up an actual script, but here’s a short example of what you could try. Create a Tag in Unity, and tag all your animated children with it. Say make a tab named Children

C# example

//Create an array.
GameObject[] children;

void Start()
{
//Define the array.

children = GameObject.FindObjectsWithTag("Children");

//Use an index to control specific children. 
//Index always starts with 0, ends with children.Length.
//Let's just say turn off animation for child number 5, we would use index 4.

children[4].GetComponent<Animation>().enabled = false;

//If you want to access ALL children, do something like this.

foreach(GameObject child in children)
{
    child.GetComponent<Animation>().enabled = true;
}

//Let's say you'd want to affect only the LAST child in the array.
//If you have for example 10 children, which would be an index of 0-9,
//you could do two things.

children[9].DoSomething
    //or
children[children.Length].DoSomething

This is not really a how-to, just something to get you started, and something for you to look into. I hope this helps you achieve what you are trying to do.