#Are all contained elements destroyed when a window is closed?

1 messages · Page 1 of 1 (latest)

blissful spire
#

I'm adding an element to the CompanyDetailWindow, but I don't know how this is handled when a window is closed. My current logic adds the element every time a window is registered in WindowManager, so if it isn't destroyed somewhere down the line it would not be great.

blissful spire
blissful spire
#
    {
        if (OnClose != null && !OnCloseAfter)
        {
            OnClose();
        }

        if (OnlyHide)
        {
            bool shown = Shown;
            WindowManager.DeregisterWindow(this);
            base.gameObject.SetActive(value: false);
            if (SpawnFrom != null && shown)
            {
                WindowManager.SpawnFader(SpawnFrom, rectTransform);
            }

            if (Parent != null && Parent.Child == this && Parent.BlockPanel != null)
            {
                Parent.Child = null;
                UnityEngine.Object.Destroy(Parent.BlockPanel);
            }
        }
        else
        {
            UnityEngine.Object.Destroy(base.gameObject);
        }

        if (OnClose != null && OnCloseAfter)
        {
            OnClose();
        }
    }```
Ok I read through the GUIWindow class and it seems they destroy themselves. Neat.

Can I mark this as solved or does someone else have to do that?