I have a light, a camera and a button. The lens flare effect has been attached to light. What I want to achieve is when I press the button - lens flare turns on and off.
Is there any way to connect to light’s Lens Flare component? Or may be I can switch off Flare Level in my camera? Or should I use layers to hide/show a flare?
Thanks.
I would really appreciate help on this.
You can technically use whatever you want but if you want to disable all at once, its definitely easiest to just disable the lens flare component on the camera
dreamora, can you, please, show a simple example of how I can access camera’s component?
var flareLayer : Behaviour;
function ToggleFlares(){
flareLayer.enabled = !flareLayer.enabled;
}
drag the Flare Layer component onto the the variable created. I have no idea what Flare Layer is in terms of code, but it types itself as a generic Behaviour so i’ll treat it that way 
Mitch,
thank you very much for the code.
What if not funny is that I sill have kind of bug. I have a layer with light. Light has a halo and lens flare effect. When I hide the whole layer - halo becomes invisible and lens flare in NOT :shock:
Is there any way to hide the freaking lens flare?
what about turning off the light?^^ if you don´t need the light, turn it off and the flair will disappear… do you still need the light without a flair? you could change the flair with an empty flair, like a kind of placeholder… this is not the best solution, but it works, too. …last but not least, you don´t need to changed layers to turn off flairs;) …and who needs a light with a halo?^^ the “halo” could be a part of the flair, so turn off halos;)
Oh, I think you understand me wrong. Halo and Lens Flare are not “inside” the light. I added them via Component > Rendering > Halo/Lens Flare panel. I really need those elements in my project.
I just don’t believe there is no way to hide Lens Flare. I’ve looked through manuals and forum posts with no success so far.
Ok, I’ve found solution. My mistake, it was just to easy. I’ve applied Lest Flare to component and then just used *.active = false code to hide it.