Lens Flares - not showing / behaving strange

EDIT: Hoping to bump this up as this is a real annoying bug. Tried it on another PC and still buggy. The Lens Flares just behave how they want. If I add a 2nd Lensflare to the scene and hide the old one, sometimes I get one to appear by disabling/enabling them or updating them otherwise.
Still they will only appear in either scene OR game view OR while running… as this is kind of urgent I hope to get some help from here. Hopefully I am not overseeing some trivial thing ;(

Hey, so this might be a bug, anyway I hope someone can help me out because this is bugging me the whole time.

Lens flare (also Halos) in general are not showing, neither in the inspector nor while running.

The Idea is to create a sun with a lens flare.
I did a very basic setup by creating a new project - importing everything and setting up a scene like this:

  1. Added a skybox texture to the Main Camera via Edit->RenderSettings (Flare layer is checked)
  2. Created a standard sphere
  3. Attached a lens flare component to the sphere
  4. Choosed a lens flare (50mm Zoom)

The funny part now happns while I run the scene:

On the lens flare component, whenever I check the “Directional” box and uncheck it again
the lens flare appears but vanishes again (shrinking until it disappears) in the same second.

After this If I stop it and check/uncheck the directional box in the game-view the lens flare magically appears! (But is still missing in the scene-view. FX effects are on)
But any changes on the lens flare makes it disappear again and the only solution is to check/uncheck the directional box again.

Also this method did not always work. Now all the lens flares are gone forever and won’t show up even with the check/uncheck method.

Creating a new scene like mentioned above not only reproduces this but I also get the following error messages over and over.
EDIT: They appeared after attaching the lens flare (Step 3):


!IsNormalized (dir)
UnityEditor.DockArea:OnGUI()

!IsNormalized (ray.GetDirection ())
UnityEditor.DockArea:OnGUI()

Scene::raycastAnyShape: The maximum distance must be greater than zero!
UnityEditor.DockArea:OnGUI()

I am using Windows Vista 64-bit with Unity free v 3.1.0f3 (54715)

Looking forward to hear from you :slight_smile:
Greetz, LOG3

Seems I’ve found a solution.

I guess the problem was that I attached the light/sun flare to the sphere.
Therefore it wouldn’t show because it was ‘inside’ the sphere.

Changing the spheres layer to ‘Transparent FX’ made it buggy. Guess the sunflare was somehow ignoring itself then…

Now I created a light with a sun flare seperately and positioned it in the center of the sphere.
Works! yay :slight_smile:

Unity 3.0.0f5 - and I’ve got the same bug - REALLY annoying!
And there’s no point if there is anything between cam and Lens Flare object or not - it just has mind of its own. Witchcraft…

One thing I had to learn, was that a Collider can cause the player to not see the lense flare, so if you have a Collider around your player to trigger stuff, you have to make sure its not around the camera. (ie camera is inside the collider) Also the Camera has to have a lense flare on it as well as it being checked on the light source (I use the light source to simulate the sun doing this)

1 Like

We (our team) had the same problem with lens flares: they was unpredictibly disappearing. This “bug” even appears from time to time in absolutely clean project, in absolutely clean scene. The worst thing here is that you never know when it will render and when it won’t. There was times when if you start unity once, flares are not visible, and if you restart unity, they are displayed as should. Yes, completely unpredictable behavior.

We tried everything. And looks like we found the source of this problem and therefore it’s solution:

  • In the object that has “Lens Flare” component, make sure that under “Ignore Layers” “Default” layer (or whatever layer your lens flare object itself is at) is NOT selected. The above problem appears only if you try to ignore the layer your flare is at.
  • Also, you should create new empty object, add “Lens Flare” component to it and parent it to some other object, rather than adding component to that “other” object directly. And that’s why: if you add this component to the object that has any collider, you’ll need to set it’s layer as ignored. And if you do so, than the layer that lens flare is at is ignored, and then you have troubles I described. The only objects that you can add Lens Flares directly at are lights. If they don’t have any collider, of course.

I’ve posted it here just to help anyone having this trouble.

P.S.: IMHO, it is a bug that Lens Flare behaves unpredictably if the layer it is on is selected in “Ignore Layers”. The fact that you can fix it with native tools is good, but it’s still a bug.

2 Likes

I’m not quite tech savvy enough to fully grasp what you are saying. Yesterday I loaded up my game and everything was fine, today after absolutely NO CHANGES were made, the flares do not work, but only for that specific game. If I pull up a new project or any other project at all, Flares work perfectly. The flares worked perfectly yesterday before I closed the game and today they do not show up no matter what I do.

Try to do what I described. This “layers stuff”.

I’ve found they don’t work in the Game view unless the Scene view has the little “Light” button turned on.

Gotcha

Thank you, you are right. Colliders somehow block the light flares.

Here, have some pikachu pumpkin and have a nice day :smile:

Thank you! I was going crazy with a similar problem!

we had precisely this problem and behavior (fast fade only upon checking “Directional” during runtime).

SOLUTION :

  1. select the Lens Flare itself (in our case, 50mm) in the Project pane.
  2. Look in the Inspector for the Flare.
  3. UNcheck “Use Fog”

BOOM. Solved.

3 Likes

BOOOM!! you’re right!!! tx!!!

Unfortunately none of these solutions worked for me, probably since I’m in a newer version. My solution was to go to my camera object, select component → Rendering → Flare Layer. This then added a flare layer to the camera and it then worked in game view! Hope this helps someone with the same struggle.

3 Likes

Adding “Flare Layer” to Camera Object and Enabling “Post Processing” in Camera Component worked for me.

1 Like

hello everybody. I did everything what you all said. still not working. its a bug. Maybe with URP doesnt work??

I found something for URP lens flare on unity assets store
LINK: SRP Lens Flare (for URP) | Fullscreen & Camera Effects | Unity Asset Store

I am gonna try it now. Hope it will work :s

Lens flare not showing up in game for me, I’ll update when I fix it.

Right now it’s your typical nightmare scenario for me: Works in editor playtesting, not when game is built.

I’ve always had strange behaviour with standard post processing effects, they always seem to come out different when a game is built vs in the editor. When dealing with post processing, it’s a good idea to check what settings work I guess in a smaller project, make sure you check what post processing fx look like when the game is built, not just playtesting in the editor.

My guess?

It’s a shader problem or conflicting shaders, that is sometimes you have one shader blocking another. It gets complex, might be the ‘depth of field sphere’ I created, might be fog conflicting with it, etc etc…

Hi, I had the same problem I am using unity 2019 and I have just created a flare layer component in the camera object it resolved to me hope it do the same to you bye!

Apologies, maybe this doesn’t belong here, but when I view a lens flare data asset, there is nothing in the inspector? But the documentation shows many parameters to the component? Also the URP sample has many different types, but when I view them (click on them) nothing shows in the inspector?