Search Issue Tracker
By Design
Votes
0
Found in
2018.4
2018.4.8f1
2019.3
2020.1
Issue ID
1183483
Regression
No
CommandBuffer on AfterLighting is not executed in a player
How to reproduce:
1. Open attached Unity project
2. Enter the play mode
3. Notice four colored point lights are rendered
4. Build and run test scene
5. Notice there are no colored lights drawn with the build
Expected result: Four colored point lights are rendered (Works in Editor).
Actual result: There are no colored lights drawn with the build.
Reproduced with: 2018.4.9f1, 2019.2.6f1, 2019.3.0b3, 2020.1.0a4
Notes:
On step 3 you can open frame debugger and notice they are drawn in the AfterLighting phase with only one draw call.
On step 5 you can open frame debugger, connect to a build and notice there's no draw call for the four lights.
Can't test on 2017.4 because of errors.
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
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
Resolution Note:
User is using GPU instancing to draw lights in this CommandBuffer, and the instancing variant is being stripped during player build (because the shader is only being used in the script).
To solve this:
Go to ProjectSettings > Graphics > scroll to bottom, there is a drop down menu called "Instancing Variants" > choose "Keep All"
----------------------------------------------
Another workaround, which is less overkill:
1. Create a material
2. Assign user's shader to this material
3. On the material inspector, enable the GPU Instancing checkbox
4. Create a monobehavior script that takes a public material and does nothing
5. Add this script component to any object on the scene
6. Save the scene and build player as usual
The idea is that, this will make the build pipeline knows there is something in the scene using this material, with the GPU instancing enabled shader variant.