Hello, I have 2 C++ widget classes (Tile and DragTile) for a UDragDropOperation inside my widget and I can’t seem to get it to work properly. Here are my events
Tiles can have different textures depending on a member variable, I set them inside of here
However whenthe NativeOnDragDetected function runs I crash because UWidgetTree::ForEachWidget says the RootWidget is null. I understand this because the RootWidget has not been set yet, here is the call stack
but I cannot set the RootWidget of the DragVisual because I get an “Object is not packaged” error if I try to do so inside the constructor. Here is how I try to set the texture:
Note that this works for UTile, but if I place this inside the NativeOnInitialized event it doesn’t run before the ForEachWidget function runs. Neither can I try to set the image inside the NativeOnDragDetected function because I get the “Object is not packaged” error again.
Am I approaching this wrong? How can I create a C++ based UUserWidget for my DefaultDragVisual and set member variables in time?