/// <summary> /// Use this function to set when witch fields should be visible. /// </summary> /// <param name='conditionMemberName'> /// The name of the Enum field. (in your case that is "type") /// </param> /// <param name='conditionValue'> /// When the Enum value is this in the editor, the field is visible. /// </param> /// <param name='showingFieldName'> /// The Field name that should only be visible when the chosen enum value is set. /// </param> protected void ShowOnEnum(string conditionMemberName, string conditionValue, string showingFieldName) { EnumFieldCondition newFieldCondition = new EnumFieldCondition(conditionMemberName, conditionValue, showingFieldName); if (!newFieldCondition.Validate(target, ToString())) { Debug.LogError(newFieldCondition.Error); return; } AddFieldCondition(showingFieldName, newFieldCondition); }
///////////////////////////////////////////////////////// /// DO NOT TOUCH THE REST /// If you make changes, it is at your own risk. /// ShowOnEnum() - Made by JWolf 13 / 6 - 2012 /// Edited by Insthync 23 / 4 - 2018 ///////////////////////////////////////////////////////// /// <summary> /// Use this function to set when witch fields should be visible. /// </summary> /// <param name='conditionFieldName'> /// The name of the Enum field. (in your case that is "type") /// </param> /// <param name='conditionValue'> /// When the Enum value is this in the editor, the field is visible. /// </param> /// <param name='showingFieldName'> /// The Field name that should only be visible when the chosen enum value is set. /// </param> protected void ShowOnEnum(string conditionFieldName, string conditionValue, string showingFieldName) { EnumFieldCondition newFieldCondition = new EnumFieldCondition() { conditionFieldName = conditionFieldName, conditionValue = conditionValue, showingFieldName = showingFieldName, isValid = true }; newFieldCondition.Validate(target, ToString()); fieldConditions.Add(newFieldCondition); }