Skip to content

Commit 3537f5f

Browse files
committed
correctly set blend mode and shader keywords when editing multiple materials at once
1 parent e3dabed commit 3537f5f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Assets/HoloToolkit/Utilities/Shaders/FastConfigurable/Editor/FastConfigurableGUI.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ public override void OnGUI(MaterialEditor matEditor, MaterialProperty[] props)
7070
CacheMainProperties(props);
7171
CacheOutputConfigurationProperties(props);
7272

73-
var mat = matEditor.target as Material;
74-
7573
// Make sure that needed setup (ie keywords/renderqueue) are set up if we're switching from an existing material.
7674
// Do this before any GUI code has been issued to prevent layout issues in subsequent GUILayout statements (case 780071)
7775
if (firstTimeApply)
@@ -94,8 +92,12 @@ public override void OnGUI(MaterialEditor matEditor, MaterialProperty[] props)
9492
}
9593
if (EditorGUI.EndChangeCheck())
9694
{
97-
SetMaterialAutoPropertiesAndKeywords(mat);
98-
SetMaterialBlendMode(mat, (BlendMode)blendMode.floatValue);
95+
foreach (var obj in blendMode.targets)
96+
{
97+
var mat = obj as Material;
98+
SetMaterialBlendMode(mat, (BlendMode)blendMode.floatValue);
99+
SetMaterialAutoPropertiesAndKeywords(mat);
100+
}
99101
}
100102
}
101103

0 commit comments

Comments
 (0)