@@ -89,24 +89,14 @@ public static void HookupTextToSpeech(this TextMeshProUGUI textMeshPro, bool for
89
89
return ;
90
90
}
91
91
92
- var skipEventAssignment = false ;
93
-
94
92
var defaultValues = textMeshProTransform . GetComponent < TextMeshProValues > ( ) ;
95
93
if ( defaultValues == null )
96
94
{
97
95
defaultValues = textMeshProTransform . gameObject ? . AddComponent < TextMeshProValues > ( ) ;
98
- defaultValues ! . FontStyles = textMeshPro . fontStyle ;
99
- defaultValues . Color = textMeshPro . color ;
100
- defaultValues . ExtraPadding = textMeshPro . extraPadding ;
101
96
}
102
97
else
103
- skipEventAssignment = true ;
104
-
105
- if ( skipEventAssignment )
106
98
{
107
- #if DEBUG
108
- //Debug.Log("Skipping event assignment!");
109
- #endif
99
+ // Skip event assignment since it should already be hooked up
110
100
return ;
111
101
}
112
102
@@ -115,13 +105,18 @@ public static void HookupTextToSpeech(this TextMeshProUGUI textMeshPro, bool for
115
105
textMeshPro . OnPointerEnterAsObservable ( ) . Subscribe (
116
106
_ =>
117
107
{
108
+ defaultValues = textMeshProTransform . gameObject ? . AddComponent < TextMeshProValues > ( ) ;
109
+ defaultValues ! . FontStyles = textMeshPro . fontStyle ;
110
+ defaultValues . Color = textMeshPro . color ;
111
+ defaultValues . ExtraPadding = textMeshPro . extraPadding ;
112
+
118
113
if ( Main . Settings ! . FontStyleOnHover )
119
114
{
120
115
for ( int i = 0 ; i < Main . Settings . FontStyles ! . Length ; i ++ )
121
116
{
122
117
if ( Main . Settings . FontStyles [ i ] )
123
118
{
124
- textMeshPro . fontStyle | = ( FontStyles ) Enum . Parse ( typeof ( FontStyles ) , Main . FontStyleNames ! [ i ] ! , true ) ;
119
+ textMeshPro . fontStyle ^ = ( FontStyles ) Enum . Parse ( typeof ( FontStyles ) , Main . FontStyleNames ! [ i ] ! , true ) ;
125
120
}
126
121
}
127
122
textMeshPro . extraPadding = false ;
0 commit comments