Animation only plays in one of the objects

I have an script when I click it will play an animation, I have cloned the Game Objects that have the animation, but for some reason only ONE of the objects will play the animation.

alt text

The object “Beacon” it’s the one with the animation, I have them with a tag “Beacon”


That is the line of script that calls the animation, but for some reason only one of the objects plays the animation the other two don’t do anything.

thank you (and sorry for bad english)


this line tells to find the first object with the tag “Beacon”.
You can use

GameObject[] obj = GameObject.FindGameObjectsWithTag ("Beacon");
if (obj.Length > 0)
    for (int i = 0 ; i < obj.Length ; i++)
        Animation a = obj*.GetComponent<Animation>();*

if (a)
That said, it would be better to use this, if you don’t have other Animation within the hierarchy.
Animation[] animations = GetComponentsInChildren();
if (animations.Length > 0)
for (int i = 0 ; i < animations.Length ; i++)