public override void OnGUI( Rect rect, SerializedProperty property, GUIContent label ) { var calculator = new Calculator(); var result = 0d; var isValid = true; try { result = calculator.Evaluate( GetStringValue( property ) ); } catch { isValid = false; } var resultString = string.Format( " = {0}", result ); GUI.color = isValid ? Color.white : Color.red; var contentPosition = EditorGUI.PrefixLabel( rect, label ); contentPosition.width -= resultStringSize; SetStringValue( property, EditorGUI.TextField( contentPosition, GetStringValue( property ) ) ); GUI.color = Color.white; contentPosition.x += contentPosition.width; contentPosition.width = resultStringSize; EditorGUI.LabelField( contentPosition, resultString ); }