Search Issue Tracker
Third Party Issue
Votes
0
Found in
6000.0.62f1
6000.2.11f1
6000.3.0b9
6000.4.0a4
Issue ID
UUM-125631
Regression
No
Error ‘cannot use casts on l-values’ when a variable is assigned inside a second-level nested if statement before being used in a conversion
How to reproduce:
1. Open the project “IN-123001_D3DTest”
2. Observe the Console
Expected result: No shader error appears in the Console
Actual result: Shader error “… cannot use casts on l-values at Assets/SampleShader.shader(98) (on d3d11)” in the Console
Reproducible with: 2023.1.0a1, 6000.0.62f1, 6000.2.11f1, 6000.3.0b9, 6000.4.0a4
Reproducible on: Windows 11
Not reproducible on: No other environments tested
Notes:
- If the error does not appear, reimport the SampleShader asset (in the Assets tab, right click the asset → Reimport)
- The shader experiencing the error does not work, appears pink
- The issue reproduces on both DX11 and DX12
- The error appears when nesting the variable in the second level of an if statement
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
- [Linux] Cannot reorder GameObjects in the Hierarchy when the AI Assistant package is installed
- [iOS] Text Input field stops receiving changes when the "Cancel" button is used on the soft keyboard
- [WebGPU] URP RenderGraph RenderPass doesn't clear textures
- Query Builder items display raw code style names instead of human readable labels in search field
- “+” button does nothing and has no functionality when clicked in Human Template "Bone Template" list
Resolution Note:
Unity's compilation toolchain isn't doing anything special to the shader beforehand and none of the active FXC flags seem relevant to the issue: seems this is an FXC bug.
Compiling through DXC (via #pragma use_dxc) functions fine, if that's an acceptable workaround.