Version 3.3.0.1

Odin has a dedicated attribute overview with examples

ButtonGroupAttribute class

Namespace: Sirenix.OdinInspector
Assembly: Sirenix.OdinInspector.Attributes
[IncludeMyAttributes]
[ShowInInspector]
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
[Conditional("UNITY_EDITOR")]
public class ButtonGroupAttribute : PropertyGroupAttribute, _Attribute

ButtonGroup is used on any instance function, and adds buttons to the inspector organized into horizontal groups.

Use this to organize multiple button in a tidy horizontal group.

Inheritance
Example

The following example shows how ButtonGroup is used to organize two buttons into one group.

public class MyComponent : MonoBehaviour
{
	[ButtonGroup("MyGroup")]
	private void A()
	{
		// ..
	}

	[ButtonGroup("MyGroup")]
	private void B()
	{
		// ..
	}
}
Example

The following example shows how ButtonGroup can be used to create multiple groups of buttons.

public class MyComponent : MonoBehaviour
{
	[ButtonGroup("First")]
	private void A()
	{ }

	[ButtonGroup("First")]
	private void B()
	{ }

	[ButtonGroup("")]
	private void One()
	{ }

	[ButtonGroup("")]
	private void Two()
	{ }

	[ButtonGroup("")]
	private void Three()
	{ }
}

Constructors

ButtonGroupAttribute(String, Single)
Organizes the button into the specified button group.
public ButtonGroupAttribute(string group = "_DefaultGroup", float order = 0F)
Parameters
System.String group

The group to organize the button into.

System.Single order

The order of the group in the inspector..

Fields

ButtonHeight
Gets the height of the button. If it's zero or below then use default.
public int ButtonHeight

Properties

ButtonAlignment
The alignment of the button represented by a range from 0 to 1 where 0 is the left edge of the available space and 1 is the right edge.
public int ButtonAlignment { get; set; }
HasDefinedButtonAlignment
public bool HasDefinedButtonAlignment { get; }
HasDefinedButtonIconAlignment
public bool HasDefinedButtonIconAlignment { get; }
HasDefinedStretch
public bool HasDefinedStretch { get; }
IconAlignment
The alignment of the icon that is displayed inside the button.
public IconAlignment IconAlignment { get; set; }
Stretch
Whether the button should stretch to fill all of the available space. Default value is true.
public bool Stretch { get; set; }