@@ -98,7 +98,7 @@ public virtual Material GetModifiedMaterial(Material baseMaterial)
98
98
Profiler . EndSample ( ) ;
99
99
}
100
100
101
- ApplyContextToMaterial ( ) ;
101
+ ApplyContextToMaterial ( _material ) ;
102
102
Profiler . EndSample ( ) ;
103
103
return _material ;
104
104
}
@@ -107,7 +107,7 @@ public virtual Material GetModifiedMaterial(Material baseMaterial)
107
107
protected override void OnValidate ( )
108
108
{
109
109
UpdateContext ( context ) ;
110
- ApplyContextToMaterial ( ) ;
110
+ ApplyContextToMaterial ( graphic ? graphic . canvasRenderer . GetMaterial ( ) : _material ) ;
111
111
SetVerticesDirty ( ) ;
112
112
SetMaterialDirty ( ) ;
113
113
@@ -141,7 +141,7 @@ public virtual void SetVerticesDirty()
141
141
if ( graphic )
142
142
{
143
143
graphic . SetVerticesDirty ( ) ;
144
- GraphicProxy . Find ( graphic ) . SetVerticesDirty ( graphic ) ;
144
+ GraphicProxy . Find ( graphic ) . SetVerticesDirty ( graphic , false ) ;
145
145
#if UNITY_EDITOR
146
146
EditorApplication . QueuePlayerLoopUpdate ( ) ;
147
147
#endif
@@ -161,14 +161,14 @@ public virtual void SetMaterialDirty()
161
161
162
162
protected abstract void UpdateContext ( UIEffectContext c ) ;
163
163
164
- public virtual void ApplyContextToMaterial ( )
164
+ public virtual void ApplyContextToMaterial ( Material material )
165
165
{
166
- if ( ! isActiveAndEnabled || context == null ) return ;
166
+ if ( ! isActiveAndEnabled || context == null || ! material ) return ;
167
167
168
- context . ApplyToMaterial ( _material , actualSamplingScale ) ;
168
+ context . ApplyToMaterial ( material , actualSamplingScale ) ;
169
169
170
170
#if UNITY_EDITOR
171
- UIEffectProjectSettings . shaderRegistry . RegisterVariant ( _material , "UI > UIEffect" ) ;
171
+ UIEffectProjectSettings . shaderRegistry . RegisterVariant ( material , "UI > UIEffect" ) ;
172
172
if ( ! EditorApplication . isPlaying )
173
173
{
174
174
EditorApplication . QueuePlayerLoopUpdate ( ) ;
0 commit comments