public override void OnSpawn()
    {
        if (scrollBar == null)
        {
            scrollBar = GetComponent <Scrollbar>();
        }

        scrollBar.direction = Scrollbar.Direction.BottomToTop;

        imageMain    = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(Image)).script as Image;
        imageHandler = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(Image)).script as Image;
        scrollArea   = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(UIMule)).script as UIMule;

        imageMain.transform.SetParent(scrollBar.transform);
        scrollArea.GetRectTransform().SetParent(scrollBar.transform);
        imageHandler.transform.SetParent(scrollArea.GetRectTransform());

        (scrollBar.transform as RectTransform).sizeDelta    = new Vector2(10, 150);
        (scrollArea.transform as RectTransform).sizeDelta   = new Vector2(10, 150);
        (imageMain.transform as RectTransform).sizeDelta    = new Vector2(10, 150);
        (imageHandler.transform as RectTransform).sizeDelta = new Vector2(10, 10);

        scrollBar.targetGraphic = imageHandler;
        scrollBar.handleRect    = imageHandler.rectTransform;

        scriptsData = new AdditionalScriptData[] {
            new AdditionalScriptData("Scrollbar", scrollBar),
            new AdditionalScriptData("MainImage", imageMain),
            new AdditionalScriptData("HandlerImage", imageHandler),
            new AdditionalScriptData("ScrollArea", scrollArea)
        };
    }
    public override void OnSpawn()
    {
        if (scrollRect == null)
        {
            scrollRect = GetComponent <ScrollRect>();
        }

        scrollRect.horizontal   = false;
        scrollRect.vertical     = true;
        scrollRect.movementType = ScrollRect.MovementType.Elastic;


        // Main image.
        mainImage = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(Image)).script as Image;

        // Image used for content ect.
        contentImage = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(Image)).script as Image;
        scrollBar    = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(ScrollbarWrapper)).script as ScrollbarWrapper;

        content = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(UIMule)).script as UIMule;
        contentImage.gameObject.AddComponent <Mask>();

        content.GetRectTransform().pivot = new Vector3(0.5f, 1);
        content.GetRectTransform().SetParent(contentImage.transform);
        mainImage.transform.SetParent(scrollRect.transform);
        contentImage.transform.SetParent(scrollRect.transform);
        scrollBar.transform.SetParent(scrollRect.transform);

        (contentImage.transform as RectTransform).sizeDelta = new Vector2(100, 150);
        scrollBar.transform.localPosition = new Vector2(60, 0);
        //sBW.transform.localPosition = new Vector3(300,0);

        scrollRect.viewport          = contentImage.rectTransform;
        scrollRect.content           = content.GetRectTransform();
        scrollRect.verticalScrollbar = scrollBar.scriptsData[0].script as Scrollbar;
        //AllignWrapperElements();

        scriptsData = new AdditionalScriptData[] {
            new AdditionalScriptData("ScrollRect", scrollRect),
            new AdditionalScriptData("MainImage", mainImage),
            new AdditionalScriptData("ContentImage", contentImage),
            new AdditionalScriptData("Scrollbar", scrollBar),
            new AdditionalScriptData("Content", content)
        };
    }
    public override void OnSpawn()
    {
        if (windowsGraphic == null)
        {
            windowsGraphic = GetComponent <Image>();
        }

        deleteButton = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(ButtonWrapper)).script as ButtonWrapper;
        content      = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(UIMule)).script as UIMule;
        windowsText  = (LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(TextWrapper)).script as TextWrapper).text;

        deleteButton.ChangeButtonSize(new Vector2(15, 15));
        deleteButton.image.color = Color.red;
        deleteButton.text.text   = "";
        windowsGraphic.color     = new Color(1, 1, 1, 0.5f);

        ChangeWindowsHeaderSize(new Vector4(25, 6, 6, 6));
        ChangeWindowsContentSize(new Vector2(100, 100));

        deleteButton.transform.SetParent(transform);
        content.transform.SetParent(transform);
        windowsText.transform.SetParent(transform);
        content.GetRectTransform().sizeDelta = new Vector2();

        deleteButton.button.onClick.RemoveAllListeners();
        deleteButton.button.onClick.AddListener(() => { gameObject.SetActive(false); });

        scriptsData = new AdditionalScriptData[] {
            new AdditionalScriptData("Windows", windowsGraphic),
            new AdditionalScriptData("DeleteButton", deleteButton),
            new AdditionalScriptData("Content", content),
            new AdditionalScriptData("WindowsText", windowsText)
        };

        transform.SetAsLastSibling();
    }