public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
    {
        UbhConditionalHideAttribute condHAtt = (UbhConditionalHideAttribute)attribute;
        bool enabled = GetConditionalHideAttributeResult(condHAtt, property);

        if (condHAtt.m_hideInInspector == false || enabled)
        {
            return(EditorGUI.GetPropertyHeight(property, label));
        }
        else
        {
            return(-EditorGUIUtility.standardVerticalSpacing);
        }
    }
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        UbhConditionalHideAttribute condHAtt = (UbhConditionalHideAttribute)attribute;
        bool enabled = GetConditionalHideAttributeResult(condHAtt, property);

        bool wasEnabled = GUI.enabled;

        GUI.enabled = enabled;
        if (condHAtt.m_hideInInspector == false || enabled)
        {
            EditorGUI.PropertyField(position, property, label, true);
        }

        GUI.enabled = wasEnabled;
    }
    private bool GetConditionalHideAttributeResult(UbhConditionalHideAttribute condHAtt, SerializedProperty property)
    {
        bool               enabled             = true;
        string             propertyPath        = property.propertyPath;
        string             conditionPath       = propertyPath.Replace(property.name, condHAtt.m_conditionalSourceField);
        SerializedProperty sourcePropertyValue = property.serializedObject.FindProperty(conditionPath);

        if (sourcePropertyValue != null)
        {
            enabled = sourcePropertyValue.boolValue;
        }
        else
        {
            Debug.LogWarning("Attempting to use a ConditionalHideAttribute but no matching SourcePropertyValue found in object: " + condHAtt.m_conditionalSourceField);
        }

        return(enabled);
    }