Widget overflow the screen when created

Hello,

I’m creating a widget on mouse cursors position. However, when mouse is too right or left, It is created outside of the screen. How can I fix that? Thank You

I updated my question. Can you please check that?

It worked but now I don’t know why but I can’t move my player or look around. I was creating functions inside level blueprint. Am I doing wrong?

Hi,

Because it creates the widget at the top left corner of the canvas. First you should attach your widget component to the anchor (place it to the top left of the canvas). Here take a look at the following images;

CORRECT !

WRONG !

UPDATE;

Follow my setup and your widget will no longer exceed the view port limits.

Widget Designer (please follow my exact widget setup)

HUD event graph

I hope it’s self explanatory XD.

Regards,

hello,

I solved the problem but now the problem is that It is created whether mouse is close enough to viewport limits. I want that widget is created enough left or right position so that It is seen even mouse is clicked when close enough to Viewport limits.

Regards

I have updated the answer. I’m so tired to explain what I did, please figure it out by yourself ;D

I understand what you are trying to do. I have just one question. I have 6 button inside a canvas. How can I do that anchor thing in canvas? Do I need to do it for every button in canvas? :smiley: THANK YOU!

No, Add a wrap box and attach all your buttons to it, then just use the wrap box size for the view port.

You have totally changed the question :D.

I couldn’t read the size of a wrap box from BPs, Try to read those values (widget width & widget height) manually. Just like how I did. Besides, a wrap box is just a holder, even getting its size from a BP, or set its size, won’t affect its children.

One thing to note is that, the setup I created inside the HUD (the one you followed) is one way of solving this issue. In fact I tried to convert the Canvas screen space into view port screen space. (that’s why I have multiplied the widget width and height by view port scale factor). There is another way in which you can do whole the thing inside Canvas screen space (convert view port space into canvas). The reason I chose the first transform, is that I found it simpler.

Check your player controller settings (movement controller events). It has nothing to do with the level BP, you may have changed something related to your character controller settings.

If it solved your problem, please mark the question as resolved. This link should help you.

Regards,