Пример #1
0
    public void CreateScreen(int index)
    {
        UIElement preFab = UIElements[index];

        System.Type type = preFab.GetType();

        if (activePopUp != null)
        {
            activePopUp.Destroy();
        }

        GameManager.dataManager.EmptySelectedWaste();

        if (activeElement == null || activeElement.GetType() != type)
        {
            if (activeElement != null)
            {
                activeElement.Destroy();
            }
            activeElement = Instantiate(preFab, gameObject.transform, false);
            activeElement.Setup();
        }
    }