[InlineButton]

Attribute adds a button inline with the field that invokes a method when clicked.

Support Types

The attribute can be applied to any field type.

Parameters

Parameter Name
Arguments
Description

method

string

Name of the method to invoke when clicked.

Label

string

Custom label for button.

Width

float

Custom width for button.

Style

string

Custom style for button.

Side

InlineDecoratorSide

On which side should the space be reserved?

Examples

using RenownedGames.Apex;
using UnityEngine;

public class InlineButtonExample : MonoBehaviour
{
    [InlineButton(nameof(RandomizeValue), Label = "Random")]
    public float value;

    [InlineButton(nameof(ResetName), Label = "Reset", Width = 60)]
    public string playerName;

    [InlineButton(nameof(ClearText), Label = "X", Width = 25, Side = InlineDecoratorSide.Right)]
    public string description;

    private void RandomizeValue()
    {
        value = Random.Range(0f, 100f);
    }

    private void ResetName()
    {
        playerName = "Player";
    }

    private void ClearText()
    {
        description = "";
    }
}