How do you restrict a button to only be visible inside a canvas in UMG?
Hey, so i'm working on a menu that have several different buttons that are being drawn to the screen. I have also made a simple way to drag the buttons around using the mouse using SetRenderTranslation. But what i cannot figure out is how i could do so that the buttons only get drawn inside the canvas they are inside in the hierarchy.
This is what it looks like at the moment, what i would like to achieve is so that when i drag the button to the location in the image only the small part inside the white window is shown, not the entire button. Does anyone know a way to do this? Any help is appriciated.
asked Mar 10 '15 at 09:58 AM in Blueprint Scripting
You should be able to toggle the visibility using remove from parent or set visibility. You are going to have to do some math though. Create a second 2D vector that adds the width and height of your container there. Those two vectors will give you your boundaries.
Get the coordinates of your widget (should return top left most corner). In your update, loop, check the widget that you are dragging's location. On each update, check if button coordinates are within the range of values.
x1y1< i < x2y2
If its within range, do nothing, else, remove from parent.
answered May 26 '15 at 07:36 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here