Problems with light illuminating objects on layers other than what is set in culling mask

I have been having an intermittent problems with lighting in unity.
Basically, the light is “illuminating” objects which are not included in the specified layer in the Culling Mask of the light.
In screen shot 1, I set a game object to a certain layer. (“L12 ceiling”)
In screen shot 2, I set another game object to a different layer (“L13 walls”)
In screen shot 3, I set the light to only “shine” on a certain layer. (“L12 ceiling”). In scene view everything looks OK.
In screen shot 4, it shows then when the game is run, it illuminates objects on layers other than the layer I specified in the inspector. (L12 and L13).

Am I doing something wrong?
Thanks
SS1:


SS2:

ss3:

ss4:

ive gotten it to work by selecting a bunch of other layers. But I dont understand WHY it works now.
Is this a bug?

Did you get any error messages?
In Unity 4 you could only exclude like 4 or so layers from lights.
So rather than including just the ceiling you should exclude the wall and use as few layers as possible.

I’d also assume that indirect light probably doesn’t respect layers.
(But I hope that whole lights can be excluded from certain layers now. Didn’t try it, though. )

1 Like

I suspect you are right about the 4 layer maximum. There is not a whole lot of help available on this topic. I did not get any error messages. The thing is is that it seems if one single light has some issue with the culling mask you set, it starts affecting every single light in the scene, which makes it hard to troubleshoot. I deleted my layers and re-created them and now it seems to work. This is the second time i had to delete layers and re-create them. Other people had issues similar to this, some people got error messages, some didnt so I dont know.

Yeah, as soon as there is one layer too many excluded, the whole system gives out.

1 Like