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
- Crash on UnityPlayer!profiling::ProfilerManager::DisposeProfilerRecorder+0xa when Player gets relaunched and exited after running for a long amount of time
- [Input system] When releasing one touch and pressing a second touch during a single frame, the second touch is not translated into UI event line OnPointerDown by the InputSystemUIInputModule
- URP Samples - multiple "Attempting to resolve render surface" and other errors appear when setting Quality pipeline asset
- OnDemandRendering.willCurrentFrameRender returns incorrect values in the Player when UnityEngine.Rendering.OnDemandRendering.renderFrameInterval is greater than 1
- Root motion is not reapplied when transitioning from an animation without root motion to an animation with root motion
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.