File tree Expand file tree Collapse file tree 6 files changed +22
-4
lines changed
Packages/com.unity.shadergraph/Samples~/UGUIShaders/Scripts/Runtime Expand file tree Collapse file tree 6 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -96,7 +96,10 @@ public virtual Material GetModifiedMaterial(Material baseMaterial)
9696 {
9797 _material ??= new ( baseMaterial ) ;
9898
99- _material . SetFloat ( StatePropertyId , ( int ) currentSelectionState ) ;
99+ _material . CopyPropertiesFromMaterial ( baseMaterial ) ;
100+
101+ if ( _material . HasFloat ( StatePropertyId ) )
102+ _material . SetFloat ( StatePropertyId , ( int ) currentSelectionState ) ;
100103
101104 return _material ;
102105 }
Original file line number Diff line number Diff line change @@ -138,8 +138,13 @@ public virtual Material GetModifiedMaterial(Material baseMaterial)
138138 {
139139 _material ??= new ( baseMaterial ) ;
140140
141- _material . SetFloat ( StatePropertyId , ( int ) currentSelectionState ) ;
142- _material . SetVector ( SliderValuePropertyId , Vector ) ;
141+ _material . CopyPropertiesFromMaterial ( baseMaterial ) ;
142+
143+ if ( _material . HasFloat ( StatePropertyId ) )
144+ _material . SetFloat ( StatePropertyId , ( int ) currentSelectionState ) ;
145+
146+ if ( _material . HasVector ( SliderValuePropertyId ) )
147+ _material . SetVector ( SliderValuePropertyId , Vector ) ;
143148
144149 return _material ;
145150 }
Original file line number Diff line number Diff line change @@ -123,10 +123,14 @@ public virtual Material GetModifiedMaterial(Material baseMaterial)
123123 {
124124 _material ??= new ( baseMaterial ) ;
125125
126- _material . SetFloat ( StatePropertyId , ( int ) currentSelectionState ) ;
126+ _material . CopyPropertiesFromMaterial ( baseMaterial ) ;
127+
128+ if ( _material . HasFloat ( StatePropertyId ) )
129+ _material . SetFloat ( StatePropertyId , ( int ) currentSelectionState ) ;
127130
128131 if ( _material . HasFloat ( IsOnPropertyId ) )
129132 _material . SetFloat ( IsOnPropertyId , isOn ? 1 : 0 ) ;
133+
130134 return _material ;
131135 }
132136
Original file line number Diff line number Diff line change @@ -99,6 +99,8 @@ public virtual Material GetModifiedMaterial(Material baseMaterial)
9999 {
100100 _material ??= new ( baseMaterial ) ;
101101
102+ _material . CopyPropertiesFromMaterial ( baseMaterial ) ;
103+
102104 if ( _material . HasFloat ( MeterValuePropertyId ) )
103105 _material . SetFloat ( MeterValuePropertyId , Value ) ;
104106
Original file line number Diff line number Diff line change @@ -128,6 +128,8 @@ public virtual Material GetModifiedMaterial(Material baseMaterial)
128128 {
129129 _material ??= new ( baseMaterial ) ;
130130
131+ _material . CopyPropertiesFromMaterial ( baseMaterial ) ;
132+
131133 if ( _material . HasVector ( RangeBarValuePropertyId ) )
132134 _material . SetVector ( RangeBarValuePropertyId , Vector ) ;
133135
Original file line number Diff line number Diff line change @@ -115,6 +115,8 @@ public Material GetModifiedMaterial(Material baseMaterial)
115115 {
116116 _material ??= new ( baseMaterial ) ;
117117
118+ _material . CopyPropertiesFromMaterial ( baseMaterial ) ;
119+
118120 if ( _material . HasVector ( PropertyId ) )
119121 _material . SetVector ( PropertyId , RectTransformInfo ) ;
120122
You can’t perform that action at this time.
0 commit comments