I’ve been trying to make a menu that whenever I click in an actor, the menu’s position change so it’s next to the selected actor. The first time (and only the first) I execute the following code, everything works fine:
element.anchoredPosition = screenPosition;
The element is correctly position. However, when I click in another position, the element’s position in the editor CHANGES, but visually it’s the same. Even the buttons inside are clickable in the new position, but Unity keeps showing the element in the older position.
I tried Canvas.ForceUpdateCanvases(), SetActive() and some other stuff, but nothing seems to work.
Here’s an image when seeing from the editor (you can the the selection border shows the new position but the UI is showing on the old one): https://i.imgur.com/Yl8LTXB.png
Thanks in advance.