Search Issue Tracker
Won't Fix
Votes
0
Found in
2021.3.39f1
2022.3.31f1
6000.0.4f1
Issue ID
UUM-73286
Regression
No
GameObject does not receive light but casts shadows when setting Light.renderingLayerMask in Play Mode
Reproduction steps:
1. Open the “ReproProject“ project
2. Open the “Assets/Scenes/SampleScene“ scene
3. Enter Play Mode
4. Observe the Game View
Expected result: The sphere receives light and casts a shadow
Actual result: The sphere casts a shadow but does not receive light
Reproducible with: 2021.3.39f1, 2022.3.31f1, 6000.0.4f1
Reproducible on: Windows 11 Pro (22H2)
Not reproducible on: No other environment tested
Notes:
1. Changing the Rendering Layers to “Light Layer 1” manually in the Inspector window for the “Directional Light” GameObject does not reproduce this issue
2. When changing the Rendering Layers to “Light Layer 1” manually, and then removing the “Light Layer 1” LayerMask makes the shadow of the sphere disappear
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- ComputeBuffer readback fails when Render Graph is enabled
- Opening Terrain Prefab in Prefab Editing Mode throws "NullReferenceException" error
- [Search] Dragging query pills put them behind the search text field
- A CustomPropertyDrawer that returns a PropertyField for a property named the same as a child field will not render all child fields
- Graphics Settings shows default values instead of the real values in the Rendering Debugger when Volume.profile is assigned via script
Resolution Note:
Hi, thank you for the report.
It would appear this is not documented correctly, but you will need to set the mask on directionalLight.gameObject.GetComponent<UniversalAdditionalLightData>().renderingLayers instead of directionalLight.renderingLayerMask in your script when using URP.
I hope this resolves your issue.