I’ve got 3 lights as child inside 3 different groups. Each of these lights has the same script. And the script determines the behaviour of the lights, which must be the same.
I want to activate the lights of each group depending on certain conditions.
The solution could become from some ways, but one of them is:
I’m thinking about re-tag them, with different tags depending on the group the lights belong to.
Should I create a vector variable of three elements and fill it in some way with the objects tagged with a certain tag defined by me and then apply a for loop for selecting them?.
var luces_respirar : GameObject[];
luces_respirar = GameObject.FindGameObjectsWithTag("luz_respirar");
if(Network.isServer)
{
if ( (luces_resp_encendidas==true)) {
for (var GameObject in luces_respirar)
{
active=true;
}
}
}