Hide
OnButtonClick
Important
Enable SaintsEditor before using

This is a method decorator, which will bind this method to the target button's click event.

Parameters:

  • string buttonTarget=null the target button. null to get it form the current target.
  • object value=null the value passed to the method. Note unity only support bool, int, float, string and UnityEngine.Object. To pass a UnityEngine.Object, use a string name of the target, and set the isCallback parameter to true
  • bool isCallback=false: when value is a string, set this to true to obtain the actual value from a method/property/field
// Please ensure you already have SaintsEditor enabled in your project before trying this example using SaintsField.Playa; [OnButtonClick] public void OnButtonClickVoid() { Debug.Log("OnButtonClick Void"); } [OnButtonClick(value: 2)] public void OnButtonClickInt(int value) { Debug.Log(
quot;OnButtonClick $
{value}"); } [OnButtonClick(value: true)] public void OnButtonClickBool(bool value) { Debug.Log(
quot;OnButtonClick $
{value}"); } [OnButtonClick(value: 0.3f)] public void OnButtonClickFloat(float value) { Debug.Log(
quot;OnButtonClick $
{value}"); } private GameObject ThisGo => this.gameObject; [OnButtonClick(value: nameof(ThisGo), isCallback: true)] public void OnButtonClickComp(UnityEngine.Object value) { Debug.Log(
quot;OnButtonClick $
{value}"); }

It'll display a UI that where the event is binded

image