using arrays to perform multiple tasks

I am using a clunky system to make a UI button push turn off all instances of another UI element (infoCard)- I have all other instances of infoCard fadeOut and the one I want to fadeIn. This means I need to maintain animation controllers for fadeIn and fadeOut of each infoCard, this is obviously very unwieldy.

I want to use an array to check to see if any infoCard is on, fade it out and fade in the infoCard corresponding to the UI button pushed. Not sure where to start though, any pushes in the right direction would be appreciated.

Thanks!

Not sure I understand, but can’t you create prefab of an infoCard that has a script that stores the state on/off in a bool variable. In Start or Awake the script could find all objects with this script and store in an array variable. The script could listen for clicks and when that happens it could iterate through the array and set the bool to false on all the instances, then set the bool on itself to true of course.

In update you could check if that bool is true or false and respectively increment or decrement a float variable that controls the visibility of the infoCard.