Files

41 lines
1.3 KiB
C#

using UnityEngine;
namespace EditorAttributes
{
/// <summary>
/// Attribute to display the specified fields in a foldout
/// </summary>
public class FoldoutGroupAttribute : PropertyAttribute
{
public string GroupName { get; private set; }
public bool DrawInBox { get; private set; }
public string[] FieldsToGroup { get; private set; }
/// <summary>
/// Attribute to display the specified fields in a foldout
/// </summary>
/// <param name="groupName">The name of the group</param>
/// <param name="fieldsToGroup">The name of the fields to group</param>
public FoldoutGroupAttribute(string groupName, params string[] fieldsToGroup)
{
FieldsToGroup = fieldsToGroup;
GroupName = groupName;
DrawInBox = false;
}
/// <summary>
/// Attribute to display the specified fields in a foldout
/// </summary>
/// <param name="groupName">The name of the group</param>
/// <param name="drawInBox">Draw the fields in the group in a nice box</param>
/// <param name="fieldsToGroup">The name of the fields to group</param>
public FoldoutGroupAttribute(string groupName, bool drawInBox, params string[] fieldsToGroup)
{
FieldsToGroup = fieldsToGroup;
GroupName = groupName;
DrawInBox = drawInBox;
}
}
}