Version 2.1.0.0

Odin has a dedicated attribute overview with examples

InlineButtonAttribute class

Namespace: Sirenix.OdinInspector
Assembly: Sirenix.OdinInspector.Attributes
[DontApplyToListElements]
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true, Inherited = true)]
public sealed class InlineButtonAttribute : Attribute, _Attribute

The inline button adds a button to the end of a property.

Inheritance
  • System.Object
  • System.Attribute
  • InlineButtonAttribute
Remarks

note

Due to a bug, multiple inline buttons are currently not supported.

Example

The following examples demonstrates how InlineButton can be used.

public class MyComponent : MonoBehaviour
{
	// Adds a button to the end of the A property.
	[InlineButton("MyFunction")]
	public int A;

	// This is example demonstrates how you can change the label of the button.
	// InlineButton also supports refering to string members with $.
	[InlineButton("MyFunction", "Button")]
	public int B;

	private void MyFunction()
	{
		// ...
	}
}

Constructors

InlineButtonAttribute(String, String)
Draws a button to the right of the property.
public InlineButtonAttribute(string memberMethod, string label = null)
Parameters
System.String memberMethod

Name of member method to call when the button is clicked.

System.String label

Optional label of the button.

Properties

Label
Optional label of the button.
public string Label { get; }
MemberMethod
Name of member method to call when the button is clicked.
public string MemberMethod { get; }