Manipulating Slot after Constructing Object

Hello,
I am trying to create a “dynamicly generated button”, which includes inserting an image inside.


The problem is, when Constructing the Image from code, I can’t really get things like “Set Horizontal/Vertical Aligment” and “Set Padding” (Target is Horizontal Box Slot) to work.


Before I tried to use “Slot as HorizontalBoxSlot” but everytime code didnt worked and throwed “Accessed None trying to read property CallFunc_SlotAsHorizontalBoxSlot_ReturnValue” error.

While trying using Cast to HorizontalBoxSlot makes the cast fail each time.

Couldn’t find on web how to properly do it, any help please?

You never add it to a horizontal box so the slot does not exist:

Huh, why haven’t I experimented with changing the order, before I was Adding child as last. It works, thanks for help.

Ah, you do add it. Just not early enough, got it.