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
- AssetBundles fail to load when running in Built Players for Mobile Devices
- UI elements with text gets bigger and grey when Player window is moved to another screen with different resolution
- System name accepts multiline text but crops it on confirmation, duplicates input, and shrinks the field when empty
- UI element scale and position are wrong in project build when DRS is changed with HDR and Software Dynamic Resolution enabled
- White lighting artifact when a point light with a small emission range and "Hard Shadows" touches an object while a directional light with "Soft Shadows" and another point light are present
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.