I have the following UMG hierarchy:
- Two uniform grid panels.
- The first grid panel contains a custom button that has an image inside of a border like this:
- When the button is clicked, it is removed from the first grid panel and added as a child to the second.
The problem I’m seeing is that after the button is moved to the second grid panel the brush color of the border gets stuck forever and there is no way to clear it. I have some blueprints that are changing the brush color when hovered/unhovered like the following:
It’s just tinting it with a slightly red color when hovered, and then after the click transfers it to the other grid panel it’s impossible to get rid of that red tint no matter what I do to change the brush color. Is there something I’m missing here? Do I need to do some special invalidation or something after reparenting?
I’ve been digging in to this, and filed bug report UE-39106. It looks like what’s happening is that when we reparent your ItemSlot_UI Userwidget, the slate resources for its hierarchy are supposed to be release and recreated. We release them, but we still have a reference to them since the instigating OnClick event came from the slate widget. We see that slate widgets already exist and end up pointing the widgets in the hierarchy back to the now released resources instead of rebuilding them. This means the UWidgets now don’t have their underlying SWidgets, and many of the widget nodes wont work.
I’m working on a proper fix, but in the meantime you can add a Delay(0) node between your click event and reparenting of the widget. This will defer the reparenting so that there are no longer any references to the slate widgets. I’ll post back here once I have a better solution for you.
Thanks Cody! That did the trick.
I checked in CL# 3213603 which should fix this issue. Let me know if you integrate it and run into any unexpected problems.