Not sure if this is the best way, but I can tell you that you can store those objects in an array, and then use a for loop to check if any of those objects has the variable as true.
lineupthesky, your code is good, but you will probably have to perform this check often (probably in the Update function) and the GetComponent function is relatively slow, so instead of having an array of Transform, you should use an array of ScriptName and get the transform property from it. This way you can avoid using GetComponent.
Use GameObject.FindGameObjectWithTag to find the objects in the Start function.
Yes my code is no appopriate for any check which is needed to be performed constantly, use the logic with his advice, reach directly to the script itself. (y)
In the script attached to the towers you could have a variable to contain a reference to the script you want to update. When that particular tower becomes selected, set the “public Transform Tower” variable directly from that tower’s script.
Just make the reference to the script public so you can drop it in.
Something like this, though I apologize if I messed it up. Quite tired here. =P
Barachiel, this would require to manually attach the ExampleScript to each tower.
Both examples so far are executed constantly in the Update function, which is a bit unnecessary.
Instead why don’t you just save the Transform of the tower in the script that does the selecting, since it already knows which tower is selected?
You could simply find the example script in the start function, no need to attach it.
If there were only a handful of towers, it might be easier to have a public variable for it so you can just drag and drop the reference to the example script, saving you a getComponent call, which is what I was suggesting in my original post. =)