Lights ignore my culling mask settings

Hi everybody.

it never happened to me before but I finally found a flaw in Unity.

Has you can see on my screenshot, the lights I put in the corridor illuminate the rooms next to it. These are RealtimeOnly spotlights with a cookie and no shadows.

I used the culling mask setting to avoid this: one layer for the corridor, and one for the rooms, and it worded well. But somehow, it stopped and now, my lights seem to consider all my layers to be the same.

I noticed that if I delete the realtimeOnly lights of my other corridor, the culling mask works again but I need these lights and intend to ad some more. For now, I have 18 real time lights.

Does anybody knows a solution?

I found it.

It turns out you can’t exclude more than 4 layers for the whole scene. I was limited by some previous settings I made on my sunlight wich excluded some other layer.

There is an error message about this: it appears when you
get beyond the limit but won’t show again if you keep using more than 4 excluded layers so be aware of it.

I reorganise my layers and it works fine now but it would be great to have more than 4 layers to work on that.

You can use all 32 layers if you use forward rendering.

–Eric

Good to know but I have to use deferred lighting because there is too much real-time lightings in my scene for the forward rendering.

Thanks anyway.