I need to search through a TAssetSubclassOf and extract some data which is a property of a UWidget which is somewhere in the tree of widgets used in the specified UUserWidget.
I was thinking I could just iterate through the array of all child widgets provided by the DefaultObject UUserWidget’s WidgetTree’s GetAllWidgets() method.
Unfortunately, WidgetTree is only created in the UUserWidget’s Initialize() method, which never gets called for CDOs.
The CDO’s Slot is also null, so I can’t just recurse through the tree of widgets accessing them that way.
Basically, I can’t locate the data which I know exists somewhere which the UUserWidget has to have somewhere in order to instantiate itself.
Does anyone have any clue where this stuff lives, or how I could get this data?
GetSlotNames() on the CDO (which could be used to get to the widgets via GetContentForSlot) also returns null for CDOs.
I tried moving the data I need from a panel to a new class inheriting from UserWidget, but then the problem just inverses since there doesn’t seem to be any way to get back to the UserWidget from the Widgets it contains. (GetParent returns a UPanel, and UUserWidget doesn’t inherit from UPanel so I can never get back to it by climbing the hierarchy of widgets and panels.)
Somehow these objects have to be connected in data… right?
I gave up on finding the proper, efficient way of doing this, so I just created an instance of the UUserWidget via CreateWidget() instead of using the CDO, pulled the data I needed form the instance, and then threw it out. Since this use case is just setting some data on a PostEditPropertyChange, it’s not all that bad in practice.
I just wish CDOs didn’t keep screwing me like this.