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
- Crash on GUIManager::DoGUIEvent when focusing on the Game view window on a specific project
- Asset creation in the Project Browser is not always undone/inconsistent when the undo shortcut is pressed right after creating an asset
- JobTempAlloc memory leak warning is thrown when the Player is shut down
- Graphics State Collection warm-up does not work when using with Addressables Shaders
- "Baked Shadow Radius" field is visible but inactive when when the Shadow Type is set to "Hard Shadows" under the Light Component
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}");
}