Unity Issue Tracker - Unused fields in constant buffers are removed when shaders are compiled
Closed
UUM-59579
Unused fields in constant buffers are removed when shaders are compiled
Unity: Shader System
Won't Fix
6.0.X
2023.3.X
2023.2.X
2022.3.X
2021.3.X
Cancelling this 2023.2 tech release issue since the support for this release has come to end of life. Cancelling this 2023.2 port case does not affect any LTS or Unity 6 Beta/Preview that remain open.
How to reproduce:
1. Open the attached “shader_issue” project
2. In the Project window, select the “sh” shader
3. In the Inspector, click “Compile and show code”
4. Using the search function (CTRL+F) find different entries for “UnityPerDraw”
5. Observe the amount of fields contained in each constant buffer
Expected result: All fields declared in the constant buffer are present
Actual result: Some fields are removed upon shader compilation