@@ -13,23 +13,23 @@ public class RestrictedAttributeDrawer : PropertyDrawer
1313 /// <summary>
1414 /// The original GUI enabled state.
1515 /// </summary>
16- protected static bool originalGUIEnabledState = GUI . enabled ;
16+ protected static bool originalGUIEnabledState ;
1717 /// <summary>
1818 /// The original GUI color.
1919 /// </summary>
20- protected static Color originalGuiColor = GUI . color ;
20+ protected static Color originalGuiColor ;
2121 /// <summary>
2222 /// The original font style.
2323 /// </summary>
24- protected static FontStyle originalFontStyle = EditorStyles . label . fontStyle ;
24+ protected static FontStyle originalFontStyle ;
2525 /// <summary>
2626 /// The original normal text color.
2727 /// </summary>
28- protected static Color originalNormalTextColor = EditorStyles . label . normal . textColor ;
28+ protected static Color originalNormalTextColor ;
2929 /// <summary>
3030 /// The original focused text color.
3131 /// </summary>
32- protected static Color originalFocusedTextColor = EditorStyles . label . focused . textColor ;
32+ protected static Color originalFocusedTextColor ;
3333 /// <summary>
3434 /// The color to use for muted text.
3535 /// </summary>
@@ -42,6 +42,12 @@ public class RestrictedAttributeDrawer : PropertyDrawer
4242 /// <inheritdoc/>
4343 public override void OnGUI ( Rect position , SerializedProperty property , GUIContent label )
4444 {
45+ originalGUIEnabledState = GUI . enabled ;
46+ originalGuiColor = GUI . color ;
47+ originalFontStyle = EditorStyles . label . fontStyle ;
48+ originalNormalTextColor = EditorStyles . label . normal . textColor ;
49+ originalFocusedTextColor = EditorStyles . label . focused . textColor ;
50+
4551 EditorGUI . BeginProperty ( position , label , property ) ;
4652 RestrictedAttribute attrib = ( RestrictedAttribute ) attribute ;
4753 Behaviour behaviour = ( Behaviour ) property . serializedObject . targetObject ;
0 commit comments