Hello all,
Been kicking around some script, and realized I made a huge error.
I have a script that toggles a Night Vision Goggle effect on the player camera, which does the normal green tint and grain effect. I also had a script that would be applied to all the light sources that would multiply their intensity whenever the player toggled the Goggles. As a result, whenever you turned on the NVGs, looking at a candle would be like looking at a 100 watt bulb, and looking at a campfire would be like glaring into the sun. Unfortunately, I took a lot of possibilities for granted when I set this up. See, the only thing I did was include a getbuttondown statement in the player camera that would toggle the effect, and the same getbuttondown statement in all the lights. I was simply assuming that whenever the level would start, the NVGs would always be off, so everybody would be on the same page. Unfortunately I’ve since given the player the ability to drop a flare. By instantiating a prefab I now have a light in the scene that may not be on the same page as everybody else. Hence, hitting the “N” button can make the flare much brighter when you’re in the dark, and nearly invisible with the NVGs on. Not at all what I want, particularly when making some details completely invisible without NVGs (IR Strobes now work 180 degrees from how they should).
I’m trying to change the matter of fact “NightVision = false” in my lights start function, into something that pulls the same boolean statement from the NightVision toggle script itself. I’m not entirely sure of the terminology for such a thing, but have to imagine that an instantiated object pulling from a script on the first frame of it’s existance has got to be more efficient than the NightVision toggle script running a find and sendmessage every frame of the update function to every gameobject in the scene.
Any help would be appreciated, it would seem like this would be one of those fairly simple problems that would be very important to learn before getting too deep into the rabbit hole. Thanks in advance,