Been looking for a way to access the SRP lens flare component for a script where I want the flare to appear larger or smaller depending on the value of a float.
I have tried using the LensFlare component, however from what I understand (I am a beginner so I might just be ignorant here) this only works for the built in pipeline lens flare (as seen here even when I declare the lens flare as public in my script I cant simply drag my game object containing the lens flare into the field).
Calling for the lens flare through the script does not seem to work either. While using the following code to access the component:
LensFlare flare = this.gameObject.GetComponent(typeof(LensFlare)) as LensFlare;
I am being returned the error:
“MissingComponentException: There is no ‘LensFlare’ attached to the “Point Light” game object, but a script is trying to access it. You probably need to add a LensFlare to the game object “Point Light”. Or your script needs to check if the component is attached before using it.”
I’ve searched for about an hour now for a way to access it via script but I keep on just circling back to the manual or the legacy manuals instructions, with the LTS manual only showing me a basic overview of the component etc. Anyone know what I might be doing wrong? Many thanks.
The class name you are looking for is