I’ve got a bit of an issue that I’m sure is something simple. Basically I’ve got an UImage widget that has it’s image updated at run time however it isn’t stretching/shrinking the content - it seems to keep the image’s original size and so is cutting half the image out when the image it’s trying to display is too large. I’ll try my best to explain how I’ve got it set up:
I’m trying to create a simple GUI that displays the player’s current weapons that they are carrying on the side of the screen. For this I’ve created a WeaponSlotWidget that contains an UImage widget - this is the image i need updated at run time.
I’ve also got a parent object that at this stage contains 2 of these weapon slot widgets called WeaponGUI, this is simply a container for the WeaponSlotWidgets at this stage.
The reason I’ve created a new widget class/Blueprint for the WeaponSlot rather than simply having UImage widgets in the WeaponGUI widget is because I need to use mouse events other than mouse down that dont seem to be supported in a simple Image widget. I’ve also got some other functionality I want to try later on and would rather keep my logic separated (this is kind of a test for a more complex UI I want to try).
I’ve tested simply using an Image widget inside the WeaponGUI and updating the contents at run time and it seems to work fine ie the image shrinks to fit the widget as expected.
In both tests the weapon image is stored as a texture asset and I then use SetBrushFromTexture to update the Image widget. I’ve also set the Brush image size settings the same.
Any help is appreciated and just let me know if there’s any extra info I can provide.