Inspector Fields

FieldTypeDescription
audioSourceAudioSourceAudioSource used to play the open and close sound clips. If left empty the window opens and closes silently.
openSoundAudioClipClip played when Open() is called.
closeSoundAudioClipClip played when Close() is called.

Methods

MethodDescription
Open()Sets the GameObject active and plays openSound. Virtual — override to run custom logic before or after showing.
Close()Sets the GameObject inactive and plays closeSound. Virtual — override to run custom logic before or after hiding.

Subclassing Window

Inherit from Window and override the virtual methods to add behaviour. Always call base.Open() or base.Close() to keep the GameObject toggle and audio working.

public class MyPanel : Window
{
    public override void Open()
    {
        // populate the panel before it appears
        Refresh();
        base.Open();
    }

    public override void Close()
    {
        base.Close();
        // clean up after the panel hides
        OnClosed?.Invoke();
    }
}

Built-in subclasses in the project: InventoryWindow, WinScreenController, GameOptionsMenu, ItemsListWindow. See UI Setup for placement and Inspector configuration guidance.