private void UpdateSelection()
    {
        // This handles us left-clicking on furniture or characters to set a selection.
        if (Input.GetKeyUp(KeyCode.Escape))
        {
            mySelection = null;
        }

        if (currentMode != MouseMode.SELECT)
        {
            return;
        }

        // If we're over a UI element, then bail out from this.
        if (EventSystem.current.IsPointerOverGameObject())
        {
            return;
        }

        if (Input.GetMouseButtonUp(0))
        {
            if (contextMenu != null)
            {
                contextMenu.Close();
            }

            // We just release the mouse button, so that's our queue to update our selection.
            Tile tileUnderMouse = GetMouseOverTile();

            if (tileUnderMouse == null)
            {
                // No valid tile under mouse.
                return;
            }

            if (mySelection == null || mySelection.Tile != tileUnderMouse)
            {
                if (mySelection != null)
                {
                    mySelection.GetSelectedStuff().IsSelected = false;
                }

                // We have just selected a brand new tile, reset the info.
                mySelection = new SelectionInfo(tileUnderMouse);
                mySelection.GetSelectedStuff().IsSelected = true;
            }
            else
            {
                // This is the same tile we already have selected, so cycle the subSelection to the next non-null item.
                // Not that the tile sub selection can NEVER be null, so we know we'll always find something.

                // Rebuild the array of possible sub-selection in case characters moved in or out of the tile.
                // [IsSelected] Set our last stuff to be not selected because were selecting the next stuff
                mySelection.GetSelectedStuff().IsSelected = false;
                mySelection.BuildStuffInTile();
                mySelection.SelectNextStuff();
                mySelection.GetSelectedStuff().IsSelected = true;
            }
        }
    }
            /// <summary>
            /// Handles clicking, in this mode it is about selecting objects.
            /// </summary>
            public void HandleClick(Vector2 position, int mouseKey)
            {
                if (modeToHandle == MouseMode.COORDINATES)
                {
                    // These ifs are separate since we want to error out if the handle != MouseMode.DEFAULT, but we don't want to error out if mouseKey != 0
                    if (mouseKey == 0)
                    {
                        if (WorldController.Instance.MouseController.contextMenu != null)
                        {
                            WorldController.Instance.MouseController.contextMenu.Close();
                        }

                        // We just release the mouse button, so that's our queue to update our selection.
                        Tile tileUnderMouse = WorldController.Instance.GetTileAtWorldCoord(WorldController.Instance.MouseController.CurrentFramePosition);

                        if (tileUnderMouse == null)
                        {
                            // No valid tile under mouse.
                            return;
                        }

                        SelectionInfo selection = WorldController.Instance.MouseController.Selection;

                        if (selection == null || selection.Tile != tileUnderMouse)
                        {
                            if (selection != null)
                            {
                                selection.GetSelectedStuff().IsSelected = false;
                            }

                            // We have just selected a brand new tile, reset the info.
                            selection = new SelectionInfo(tileUnderMouse);
                            selection.GetSelectedStuff().IsSelected = true;
                        }
                        else
                        {
                            // This is the same tile we already have selected, so cycle the subSelection to the next non-null item.
                            // Note: Tile sub selection can NEVER be null, so we know we'll always find something.

                            // Rebuild the array of possible sub-selection in case characters moved in or out of the tile.
                            // [IsSelected] Set our last stuff to be not selected because were selecting the next stuff
                            selection.GetSelectedStuff().IsSelected = false;
                            selection.BuildStuffInTile();
                            selection.SelectNextStuff();
                            selection.GetSelectedStuff().IsSelected = true;
                        }

                        // This will make sure that if we created new selectioninformation it is reflected
                        WorldController.Instance.MouseController.Selection = selection;
                    }
                    else if (mouseKey == 1)
                    {
                        Vector3 mousePosition = position;
                        mousePosition.z = WorldController.Instance.CameraController.CurrentLayer;
                        Tile t = WorldController.Instance.GetTileAtWorldCoord(mousePosition);
                        if (WorldController.Instance.MouseController.contextMenu != null && t != null)
                        {
                            if (WorldController.Instance.MouseController.IsPanning)
                            {
                                WorldController.Instance.MouseController.contextMenu.Close();
                            }
                            else
                            {
                                WorldController.Instance.MouseController.contextMenu.Open(t);
                            }
                        }
                    }
                }
                else
                {
                    // Not implemented by the UI Handlers
                    throw new InvalidOperationException("Only supports DEFAULT, UI Handlers while supported by this class aren't supported by this function.");
                }
            }