UI Element - is an abstract script created to simplify the use of UI panels and windows. It is easy to show and hide UI elements.
Canvas Group - the link to a convenient component from Unity that allows you to quickly hide and make non-interactive UI an object and all its children.
Is Showed - state of the item.
On Element State Changed - action invokes when element state changes.
QUESTIONS:
How to use? - Create a new C# script for your panel or UI element and inherit it from UIElement. Be sure to announce the OnShow() and OnHide() methods. In this class you can implement the logic of your panel.
public class Name : UIElement
{
protected override void OnShow()
{
//Do something
}
protected override void OnHide()
{
//Do something
}
}
2. How to change panel state? - If you need to turn on the panel by pressing the button, you can use Panel Opener or do it manually.
[SerializeField] private UIElement _panel;
private void Start()
{
_panel.ShowElement();
//or
_panel.HideElement();
}