Search Issue Tracker
By Design
Votes
0
Found in
2022.3.65f1
6000.0.54f1
6000.1.13f1
6000.2.0b10
6000.3.0a2
Issue ID
UUM-112975
Regression
No
Material does not update when setting an enum keyword using EnableKeyword
Reproduction steps:
1. Open the attached “BugRepro” project
2. Open the “Assets/DevDunkStudio/Depth Shadows/Demo/Scenes/DepthShadowDemo.unity“ Scene
3. Double-click on the “ShadowPlane” GameObject in the Hierarchy window (Zoom in the Scene view if the shadow isn’t visible)
4. In the Inspector window, under the “Depth Shadows” component, change the Sample Type
5. Observe the shadow in the Scene view
Expected result: Material updates based on the selected Sample Type
Actual result: Material remains unchanged
Reproducible with: 2022.3.65f1, 6000.0.54f1, 6000.1.13f1, 6000.2.0b10, 6000.3.0a2
Reproducible on: Windows 11
Not reproducible on: No other environment tested
Workaround: Manually disable all enum keywords before enabling the selected one (uncomment lines 202-204 in DepthShadow.cs)
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
- URP Realtime reflection probes do not update when RenderProbe() is being called once per second
- Addressable terrain shader variants are stripped from the Player
- [iOS] Debug.Log() appears as <private> in Console app
- UI stays in the background when it is disabled in simulator
- A wrong log file is attached when project is launched with a "-logFile" command line argument
Resolution Note:
We don't officially support an API entry point for keyword enum at the moment- something we are aware of and plan on improving. So yes- you need to explicitly disable all other keywords. You can write a helper to do this, such as the following:
(please excuse the formatting)
public static void SetLocalKeywordEnum(Material mat, string referenceName, string value)
{
foreach (var keyword in mat.enabledKeywords)
if (keyword.name.StartsWith(referenceName))
mat.DisableKeyword(keyword);
mat.EnableKeyword($"{referenceName}_{value}");
}