Neg_Utils/NEG/UI/UnityUi/Buttons/ButtonReaction.cs

15 lines
414 B
C#

using System;
using UnityEngine;
namespace NEG.UI.UnityUi.Buttons
{
[RequireComponent(typeof(BaseButton))]
public abstract class ButtonReaction : MonoBehaviour
{
private void Awake() => GetComponent<BaseButton>().OnButtonPressed += OnClicked;
private void OnDestroy() => GetComponent<BaseButton>().OnButtonPressed -= OnClicked;
protected abstract void OnClicked();
}
}