- Home /
How can I add flare layer via code?
I've looked throught the documentation and can't seem to find any reference to the 'FlareLayer' component other than this
I need to add a flare layer to a scripted camera but I can't find any reference to the component name, constructor or properties in either VS or the documentation. Where is it?
Idealy i need something like: myScriptedCamera.addComponent();
Thanks!
Answer by Mike 3 · May 24, 2010 at 04:47 PM
myScriptedCamera.AddComponent("FlareLayer");
I believe this already got answered in IRC, but thought it would be best to add it here too for completion
FlareLayer only exists in the C++ part of the engine, there is no C# class for it in the API, so you need to use the string version to add it
Then how would you disable/enable the flarelayer?
this.gameObject.GetComponent("FlareLayer").enabled=false;
and 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?)