- Home /
Flare Layer on, off?
Camera turned on by default, as per attached, and I want to control the Flare Layer, Script Reference seems to be no relevant information. Or I will not find it in? Help me to get an answer.
Answer by Taugeshtu · Apr 14, 2011 at 10:11 PM
Some sort of bad solution there: Find all objects with flare components on them, then on/off flare components...
Sorry, better one:
Camera.main.GetComponent("FlareLayer").enabled = false;
And anything like that ;) Cheers.
I got this :
error CS1061: Type `UnityEngine.Component' does not contain a definition for `enabled' and no extension method `enabled' of type `UnityEngine.Component' could be found (are you missing a using directive or an assembly reference?)
Answer by Juanes · Nov 15, 2012 at 09:42 PM
I just did this and it seems to work:
Behaviour flareLayer = (Behaviour)Camera.main.GetComponent ("FlareLayer");
if (flareLayer != null)
flareLayer.enabled = false;
Strangely, the FlareLayer class is not available from scripts (might be private or something). That's why you can't cast to FlareLayer class; instead, you can cast to Behaviour class.
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Camera follow help? 1 Answer
Minimap clicking RTS style feature 3 Answers
camera focus on sphere 1 Answer
Keep character inside camera bounds 1 Answer