Version 3.1.11.0

Odin has a dedicated attribute overview with examples

InlineButtonAttribute class

Namespace: Sirenix.OdinInspector
Assembly: Sirenix.OdinInspector.Attributes
[DontApplyToListElements]
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Parameter | AttributeTargets.Delegate | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter | AttributeTargets.All, AllowMultiple = true, Inherited = true)]
[Conditional("UNITY_EDITOR")]
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 action, string label = null)
Parameters
System.String action

A resolved string that defines the action to perform when the button is clicked, such as an expression or method invocation.

System.String label

Optional label of the button.

Fields

Action
A resolved string that defines the action to perform when the button is clicked, such as an expression or method invocation.
public string Action
Label
Optional label of the button.
public string Label
ShowIf
Optional resolved string that specifies a condition for whether to show the inline button or not.
public string ShowIf