public void NavigateAuto(UISlotPanel panel, Vector2 dir)
        {
            if (panel != null)
            {
                int slots_per_row = panel.slots_per_row;
                int prev_select   = panel.selection_index;

                if (IsLeft(dir))
                {
                    panel.selection_index--;
                }
                else if (IsRight(dir))
                {
                    panel.selection_index++;
                }
                else if (IsUp(dir))
                {
                    panel.selection_index -= slots_per_row;
                }
                else if (IsDown(dir))
                {
                    panel.selection_index += slots_per_row;
                }

                if (panel.IsSelectedInvisible())
                {
                    Navigate(panel, dir); //Continue same dir
                }
                if (!panel.unfocus_when_out && !panel.IsSelectedValid())
                {
                    panel.selection_index = prev_select; //Dont exit panel, set to previous
                }
                if (panel.unfocus_when_out && !panel.IsSelectedValid())
                {
                    UISlotPanel.UnfocusAll(); //Exit panel
                }
            }
        }