UMG Widgets Size to content breaks onClicked event

I had to check for button presses using event tick instead in my menu UMG as the event onClicked for each button never worked for me. I sat down and went through each option trying to figure out what breaks it and a button that doesn’t have size to content clicked works with the onClicked event, whereas if you have size to content selected then the onClicked event doesn’t call.

Hello ,

I was unable to reproduce this issue on my end. I have a few questions for you that will help narrow down what issue it is that you are experiencing.

Quick questions:

  1. What version of the engine are you using?
  2. Can you reproduce this in a clean project?
  3. If so, could you provide a detailed list of steps to reproduce this on our end?
  4. Could you provide a screen shot of your blueprints and/or issue?
  5. When you say that the OnClicked event doesn’t work, do you mean that it doesn’t fire off at all or that when it fires off nothing happens or that you are unable to click the button at all?
  1. The version of the engine is 4.6.1.
  2. It’s clearly to do with the hit box and how the engine defaults with Size to content. It doesn’t size the other styles to each other and therefore the hit box is off. I have added a link to a video where I stated each bit step by step.

It may be a little thing but allowing us to add in a singular image for the normal style so we know what the button does and automatically sizing the other styles to this size allows me to make UI more rapidly and test quicker. Rather than me having to set other styles up so I can tell i’m pressing it or going in to remove it by hand like in the video / setting the image size on each manually.

Hello ,

After looking over your video it would appear that the engine is working as intended. “Image size” is the property that sets the size of the button when “Size to content” is set to true. What you are seeing in the video is that the button’s hovered image size is set to 32 by 32 as its default. This is why it shrinks down to the size seen in the video and why it works after you have applied your image (when the image is applied the image size is changed) I hope that this helps. Thank you for your information and your time.

Make it a great day

This doesn’t seem to be efficient at all though. If you have a button and you change a single style and tick size to content, it should default the other image sizes automatically on the other styles as the button will be the same size when hovered and pressed, even when there is no image set. Having to input it manually just seems so silly considering it seems that’s what Size to content should do automatically.

It just makes testing the functionality of the UMG widgets quicker as otherwise we would have to go in and type by hand each image size for each style to make it work correctly or create a image for each style so we can tell its been clicked.

Its mostly a suggestion now as I know lots of people who thought that it would work this way too due to the naming of the ‘Size to content’ and how other things in UE4 will do things like this automatically.

Thanks for looking at it though!

Hello ,

I spoke with a couple of others and they agreed that this would be a good feature. I have written up a report (UE-8427) and I have submitted the feature request to the developers for further consideration. I will provide updates with any pertinent information as it becomes available.

Make it a great day

Thank you very much!

Agreed!
Had the same problem a few days ago. UMG is pretty frustrating, isn’t it? :wink:
Just took me a week to do some basic D&D, the result is lots of spaghetti code both on BP and C++ side of things. Hang on.