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
- [Web][iOS] Web Player keeps restarting on launch when Native C/C++ Multithreading is enabled
- "Add Scene to Scenes in Build" pop-up reappears after Scene has already been added and another Multiplayer Editor Instance is loaded
- TableEntryAdded event is not triggered when a new entry is added in the Localization Tables window
- The macOS Player is built to a different folder than the selected one when the Player is built on Windows
- Editor memory leak in VisualElement when recompiling in a blank URP project
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.