I’ve recently upgraded my project from UE5 to 5.1 and am having a new widget bug.
The problem:
I have an inventory system whereby when i right click on an item in the inventory, i get the mouse position and set that position in the viewport to create another menu. This was working fine in UE5 but ever since i have upgraded to 5.1, the widget now only creates in the top left corner and i can’t figure out how to get it to create at mouse location. When i do a print string after adding to viewport i can see the mouse coordinates are being updated correctly but for some reason the widget still creates in the top left corner. I haven’t anchored the widget to the top left either it is set to fill desired space of 120 x 80.
Hey there @josh_smithson1! Does setting the position in the viewport work outside of the frame it’s generated in? ie does an empty delay effect it here?
Thanks for replying to me but i’m not sure what you mean by “Does setting the position in the viewport work outside of the frame it’s generated in?”.
Do you mean i should try setting the position to viewport in a different part of my WB?
I have another function using “Get Mouse Position On Viewport” to display a different menu to choose how many items to drop. This was also working before the update but now it also shows in the top left.
This is definitely an odd one, I can’t get it to move with your setup in 5.1 either. I don’t work with UI too often so I’m preparing some tests to see where exactly it’s failing.
Very strange right?! Please let me know if you manage to find a work around, i will do the same although i’m fast running out of ideas for things to try.
There’s definitely a workaround in the form of having your subwidgets already on a canvas and just calling to them to open/close and just move them on the canvas coords, but that’d be a bit of a rewrite of your UI system.
I’ve managed to get it working now, I will paste screenshots below of the fix. It turns out the “Set Position in Viewport” node isn’t working properly as of update 5.1. To fix, i made a border around my submenu and set it as variable. I then called to that border variable and set it as canvas slot. After that i set position as canvas slot using “get mouse position on viewport” for the mouse x/y.