How to disable animations of other child objects when animation of one of that objects is running on click

Hello. I have multiple child gameobjects and each of them has some animation. Animations are triggered on click. But problem is that I can click on multiple objects and animations are running all together. How can I solve this, that I can click only on one object and after animation is finished I can click on another one? I am thinking about one solution that I will disable animator on each other object, but I would need to add reference to all other objects and disable animator component… hopefully there will be some better solution. And also other objects have some idle animations so probably disabling animator will be not the best solution. Thanks

Ok, you didn’t provide any code, but I suggest using a coroutine and waiting for the animation to complete, while the animation is running. The code below should give you an idea

bool animRunning = false;
[SerializeField] Animator anim;

void Update()
{

if (Input.GetMouseButton(0) && !animRunning)
{
//I don't know how you are clicking on your target object, but you didn't provide code and it sounds like you have that worked out already, just do it in here, lets say its a raycast
if(hit.transform.tag == "targetTag")
{
animRunning = true;
anim.SetTrigger("parameterName");
StartCoroutine(WaitForAnimation());
}
}
IEnumerator WaitForAnimation()
{
    //Fetch the current Animation clip information for the base layer
    AnimatorClipInfo[] currentClipInfo = anim.GetCurrentAnimatorClipInfo(0);
     yield return new WaitForSeconds(currentClipInfo[0].clip.length);
     animRunning = false;
    }
}