You can add a [Button] attribute before a method to display a button in the inspector.
When clicked, it will execute the method linked to the button attribute.
using BaseTool;
using UnityEngine;
public class ButtonTest : MonoBehaviour
{
[Button]
public void DoSomething()
{
Debug.Log("Method called from inspector");
}
}
ButtonAttribute
You can add a
[Button]
attribute before a method to display a button in the inspector. When clicked, it will execute the method linked to the button attribute.