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

22 lines
535 B
C#

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