Hello,
I’m using Input.MousePosition to move a panel to the position of the mouse like so:
Vector2 pos = new Vector2(Input.mousePosition.x + (inventory.optionsMenuRect.rect.width / 2) + 2, Input.mousePosition.y);
inventory.optionsMenu.transform.position = pos;
How this occurs is I click on an item within my inventory the window is moved to the position of the mouse and then set active. When the mouse leaves the window it will go back to being inactive. Everything works fine the second time. However, when I try to do it any number of consecutive times sometimes the window will stay in the previous positions, the buttons inside the panel will not work anymore and the window will move but just not to the correct place.
Any idea why this is happening?