private bool GetConditionAttributeResult(MMEnumConditionAttribute enumConditionAttribute, SerializedProperty property) { bool enabled = true; SerializedProperty enumProp; string enumPropPath = string.Empty; string propertyPath = property.propertyPath; if (!cachedPaths.TryGetValue(propertyPath, out enumPropPath)) { enumPropPath = propertyPath.Replace(property.name, enumConditionAttribute.ConditionEnum); cachedPaths.Add(propertyPath, enumPropPath); } enumProp = property.serializedObject.FindProperty(enumPropPath); if (enumProp != null) { int currentEnum = enumProp.enumValueIndex; enabled = enumConditionAttribute.ContainsBitFlag(currentEnum); } else { Debug.LogWarning("No matching boolean found for ConditionAttribute in object: " + enumConditionAttribute.ConditionEnum); } return(enabled); }
private bool GetConditionAttributeResult(MMEnumConditionAttribute enumConditionAttribute, SerializedProperty property) { bool enabled = true; string propertyPath = property.propertyPath; string conditionPath = propertyPath.Replace(property.name, enumConditionAttribute.ConditionEnum); SerializedProperty sourcePropertyValue = property.serializedObject.FindProperty(conditionPath); if (sourcePropertyValue != null) { int currentEnum = sourcePropertyValue.enumValueIndex; enabled = enumConditionAttribute.ContainsBitFlag(currentEnum); } else { Debug.LogWarning("No matching boolean found for ConditionAttribute in object: " + enumConditionAttribute.ConditionEnum); } return(enabled); }