- Home /
We're having trouble with our torch turning on and off all lights
Me and a mate are making our own game and we've got a torch for the player and lamps spread across the map. We're having trouble when we turn the torch on and off because when we turn the torch on, all the lamps in the map turn off and vice versa. How can we fix this?
We need to see codes. Right now we can only say that maybe you are using FindObjectsWithTag and all torches have the same tag. But how would I know...?
fafase is right. You need to post the code, or we won't know what you might have done wrong.
It's likely because you're using static variables, so don't do that.
I don't know if this is the right script and I can't get of my friend because he has the script and I wont be able to see him for a while but we're using the toggleLight.
@Eric5h5 is right (as always)
wherever toggleLight is declared, it probably says something like:
static var toggleLight : boolean;
just remove the "static" keyword
Answer by Screenhog · Aug 07, 2012 at 04:44 PM
Are you using the same material for the torch and the lamps? If so, are you editing the material directly to turn the torch on and off?