Neg_Utils/NEG/UI/UnityUi/Buttons/CloseWindow.cs
2024-02-12 21:26:24 +01:00

21 lines
522 B
C#

using NEG.UI.UnityUi.Window;
using NEG.UI.Window;
using UnityEngine;
namespace NEG.UI.UnityUi.Buttons
{
[RequireComponent(typeof(BaseButton))]
public class CloseWindow : ButtonReaction
{
[SerializeField] private MonoWindow windowToClose;
private void OnValidate()
{
if (windowToClose != null)
return;
windowToClose = GetComponentInParent<MonoWindow>();
}
protected override void OnClicked() => windowToClose.Close();
}
}