Search Issue Tracker
By Design
Votes
0
Found in
2019.1.0a1
2019.1.0a14
2019.1.0f1
2019.2.0a1
2019.3.0a1
Issue ID
1145965
Regression
Yes
Using UsePass "Standard/SHADOWCASTER", IsKeywordEnabled("_ALPHABLEND_ON") prints true, but its not present in Frame Debugger
To reproduce:
1. Open users attached project "TestVRM.zip"
2. Open "SampleScene.unity" scene
3. Select "Cube1" game object in the hierarchy
4. Press in the top menu Test > Test
5. Observe the console as Debug.Log(Selection.activeGameObject.GetComponent<Renderer>().material.IsKeywordEnabled("_ALPHABLEND_ON")); prints true
6. Select "Cube2" game object in the hierarchy
7. Press in the top menu Test > Test
8. Observe the console as Debug.Log(Selection.activeGameObject.GetComponent<Renderer>().material.IsKeywordEnabled("_ALPHABLEND_ON")); prints true
9. Open Analysis > Frame Debugger and enable it
10. Select Draw Mesh Cube1 from the list on the left and observe as _ALPHABLEND_ON keyword is present
12. Select Draw Mesh Cube2 from the list on the left and observe as _ALPHABLEND_ON keyword is not present even though material.IsKeywordEnabled("_ALPHABLEND_ON") returns true
Expected result: if the keyword is not present in the shader IsKeywordEnabled("_ALPHABLEND_ON") should print out "False"
Actual result: IsKeywordEnabled("_ALPHABLEND_ON") prints out "True" even though it is not shown in the Frame Debugger
Reproduced on:
2019.1.0a14 2019.1.f1 2019.2.0a14 2019.3.0a1
Not reproduced on:
2018.3.0f1 2018.3.14f1 2019.1.0a1 2019.1.0a13
Notes:
- Reproduces on Metal and OpenGLCore
- Same results on macOS and win10 machines
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 (2019.3.X):
Local keywords are prioritized over global ones. This means that if a shader defines a keyword both as local and global, only the local one will work as expected.
The user shader in this case is defining _ALPHABLEND_ON as global keywords but the UsePass source defines it as local keyword. When enabling _ALPHABLEND_ON from the script, it will affect only the local keyword. This can be easily worked around by modifying the shader to not have conflicting keyword types. In this particular case modifying the _ALPHABLEND_ON to use multi_compile_local is the correct fix.
We acknowledge that the current situation is not optimal as the local keywords feature can break existing content in some cases and those can't be resolved with automatic shader upgrader. To make these cases easier to spot and fix, we'll be adding new warnings when having conflicting keyword definitions in the shaders.