# Pulling widget data from a UUserWidget CDO's contents

**URL:** <https://forums.unrealengine.com/t/pulling-widget-data-from-a-uuserwidget-cdos-contents/394978>\
**Category:** UI\
**Tags:** cdo, unreal-engine, Widget, question, CPP\
**Created:** [May 30, 2017, 1:27pm UTC](https://forums.unrealengine.com/t/pulling-widget-data-from-a-uuserwidget-cdos-contents/394978 "2017-05-30T13:27:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Teiwaz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Teiwaz](https://forums.unrealengine.com/u/Teiwaz)\
**Post date:** [May 30, 2017, 1:27pm UTC](https://forums.unrealengine.com/t/pulling-widget-data-from-a-uuserwidget-cdos-contents/394978/1 "2017-05-30T13:27:36Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Teiwaz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Teiwaz](https://forums.unrealengine.com/u/Teiwaz)\
**Post date:** [May 30, 2017, 4:41pm UTC](https://forums.unrealengine.com/t/pulling-widget-data-from-a-uuserwidget-cdos-contents/394978/2 "2017-05-30T16:41:15Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Teiwaz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Teiwaz](https://forums.unrealengine.com/u/Teiwaz)\
**Post date:** [May 30, 2017, 8:52pm UTC](https://forums.unrealengine.com/t/pulling-widget-data-from-a-uuserwidget-cdos-contents/394978/3 "2017-05-30T20:52:26Z")

</div>

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.
