private void UpdateLayout(int numOfRows, int numCols)
        {
            CheckMenuVisibility();
            try
            {
                int numOfCols = isAssetEditorMode ? 7 : numCols;

                UITabContainer gtsContainer;

                tsContainer.height = Mathf.Round(104f * numOfRows) + 1;
                tsContainer.width  = Mathf.Round(859f - 763f + 109f * numOfCols) + 1;

                foreach (UIComponent toolPanel in tsContainer.components)
                {
                    if (toolPanel is UIPanel)
                    {
                        gtsContainer = toolPanel.GetComponentInChildren <UITabContainer>();

                        if (gtsContainer != null)
                        {
                            foreach (UIComponent tabPanel in gtsContainer.components)
                            {
                                tabPanel.height = tsContainer.height;
                                tabPanel.width  = tsContainer.width;

                                UIScrollablePanel scrollablePanel = tabPanel.GetComponentInChildren <UIScrollablePanel>();
                                if (scrollablePanel != null)
                                {
                                    scrollablePanel.height = tsContainer.height;
                                    scrollablePanel.width  = Mathf.Round(109f * numOfCols) + 1;
                                }

                                // don't mess further with Find It's panel
                                if (tabPanel.name == "FindItDefaultPanel")
                                {
                                    continue;
                                }

                                if (numOfRows > 1)
                                {
                                    UIScrollbar horizontalScrollbar = tabPanel.GetComponentInChildren <UIScrollbar>();
                                    if (horizontalScrollbar != null)
                                    {
                                        horizontalScrollbar.value = 0;
                                    }

                                    if (scrollablePanel != null)
                                    {
                                        scrollablePanel.autoLayout           = true;
                                        scrollablePanel.autoLayoutStart      = LayoutStart.TopLeft;
                                        scrollablePanel.wrapLayout           = true;
                                        scrollablePanel.autoLayoutDirection  = LayoutDirection.Horizontal;
                                        scrollablePanel.scrollWheelDirection = UIOrientation.Vertical;
                                    }

                                    UIScrollbar verticalScrollbar;
                                    if (dictVerticalScrollbars.ContainsKey((UIPanel)tabPanel))
                                    {
                                        verticalScrollbar = dictVerticalScrollbars[(UIPanel)tabPanel];
                                        AdjustVerticalScrollbar(verticalScrollbar, tabPanel, scrollablePanel);
                                    }
                                    else
                                    {
                                        verticalScrollbar = CreateVerticalScrollbar((UIPanel)tabPanel, scrollablePanel);
                                        dictVerticalScrollbars[(UIPanel)tabPanel] = verticalScrollbar;
                                    }
                                    verticalScrollbar.Show();
                                }
                                else
                                {
                                    if (scrollablePanel != null)
                                    {
                                        scrollablePanel.autoLayout           = true;
                                        scrollablePanel.autoLayoutStart      = LayoutStart.TopLeft;
                                        scrollablePanel.wrapLayout           = false;
                                        scrollablePanel.autoLayoutDirection  = LayoutDirection.Horizontal;
                                        scrollablePanel.scrollWheelDirection = UIOrientation.Horizontal;
                                        scrollablePanel.ScrollToLeft();
                                    }

                                    UIScrollbar verticalScrollbar;
                                    if (dictVerticalScrollbars.ContainsKey((UIPanel)tabPanel))
                                    {
                                        verticalScrollbar = dictVerticalScrollbars[(UIPanel)tabPanel];
                                        AdjustVerticalScrollbar(verticalScrollbar, tabPanel, scrollablePanel);
                                    }
                                    else
                                    {
                                        verticalScrollbar = CreateVerticalScrollbar((UIPanel)tabPanel, scrollablePanel);
                                        dictVerticalScrollbars[(UIPanel)tabPanel] = verticalScrollbar;
                                    }
                                    dictVerticalScrollbars[(UIPanel)tabPanel].Hide();

                                    UIScrollbar horizontalScrollbar = tabPanel.GetComponentInChildren <UIScrollbar>();
                                    if (horizontalScrollbar != null)
                                    {
                                        if (horizontalScrollbar.decrementButton != null)
                                        {
                                            horizontalScrollbar.decrementButton.relativePosition = new Vector3(horizontalScrollbar.decrementButton.relativePosition.x, horizontalScrollbar.height / 2f - 16f);
                                        }
                                        if (horizontalScrollbar.incrementButton != null)
                                        {
                                            horizontalScrollbar.incrementButton.relativePosition = new Vector3(horizontalScrollbar.incrementButton.relativePosition.x, horizontalScrollbar.height / 2f - 16f);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                if (isFindItEnabled)
                {
                    FindItLayoutPatch();
                }
                if (isRICOEnabled && (!isEditorMode))
                {
                    PloppableRICOLayoutPatch(numOfRows, numOfCols);
                }
            }
            catch (Exception ex)
            {
                Debugging.Message("UpdateLayout() - " + ex.Message);
            }
        }