How to disable other game objects in an array when one of them is "repairing"

Hey guys,

I’m working on something where I have several UIs that are showing the health of several game objects. On each UI is a health bar and a “repair” button. When the button is clicked, the game object goes into repair mode and replenishes its health.

My question is this. I only want one game object to be repairing at any one time. So when one is repairing, the repair buttons on the rest of the UIs need to be disabled.

Unfortunately, it’s not as simple as just running a for loop, finding the one that is repairing, and disabling the rest. Because if NONE of them are repairing, then none of them should be disabled.

I’ve been trying to wrap my head around this one for a few days now, and can’t figure it out. Can anyone let me know what the best approach is for something like this is?

Unless I am missing something with your question, this sounds pretty straight forward.

When button is pressed to repair, traverse list of objects and set all repair buttons interactive = false.
Then when object has completed repairing, traverse list of objects and set all repair buttons interactive = true.