# Packaging fails to package widget blueprints referenced from code

**URL:** <https://forums.unrealengine.com/t/packaging-fails-to-package-widget-blueprints-referenced-from-code/333194>\
**Category:** UI\
**Tags:** unreal-engine, packaging-projects, Widget, question\
**Created:** [September 23, 2015, 9:01pm UTC](https://forums.unrealengine.com/t/packaging-fails-to-package-widget-blueprints-referenced-from-code/333194 "2015-09-23T21:01:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![BujakD](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BujakD](https://forums.unrealengine.com/u/BujakD)\
**Post date:** [September 23, 2015, 9:01pm UTC](https://forums.unrealengine.com/t/packaging-fails-to-package-widget-blueprints-referenced-from-code/333194/1 "2015-09-23T21:01:49Z")

</div>

Hi,

repro steps:

1. Create new project based on “first person” c++ example.

2. In content folder create widget (AddNew-\>UI-\>WidgetBlueprint) and name it W\_UnitWidget.

3. Open VS, and go to [ProjectName]Character.cpp file.

4. In constructor at the end add this code:

Remember to put aproppriete widget reference in MyObj contructor.

1. Compile. After hot reload hit play in editor or play in standalone widow. Debug message “widget found” appears. Our widget was properly foun.
2. Go to File-\>Package project-\>Packageing settings. Check “Full rebuild”
3. Package project (File-\>Package project-\>Widnows-\>Windows 64 bit)
4. After packageing is done go to packaged project and run game
5. Game will prompt that W\_UnitWidget was not found

cheers

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b666e59e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b666e59e](https://forums.unrealengine.com/u/anonymous_user_b666e59e)\
**Post date:** [September 24, 2015, 7:15pm UTC](https://forums.unrealengine.com/t/packaging-fails-to-package-widget-blueprints-referenced-from-code/333194/2 "2015-09-24T19:15:46Z")

</div>

Hi Buyaka,

Thank you for pointing this out to us. I was able to reproduce what you described using your repro steps (very clear, thank you!), and have submitted a report of my observations to have this investigated further (UE-21466).

---

<div class="post-metadata">

**Author:** ![NickDarnell](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NickDarnell](https://forums.unrealengine.com/u/NickDarnell)\
**Post date:** [September 29, 2015, 2:24pm UTC](https://forums.unrealengine.com/t/packaging-fails-to-package-widget-blueprints-referenced-from-code/333194/3 "2015-09-29T14:24:20Z")

</div>

Not a bug, the WidgetBlueprint is an editor only class. You can tell because it’s in a module in the Editor directory. UBlueprints should’ve been and hopefully will in the future. You need to reference the generated UClass instead, the “\_C” object that’s generated when you compile a blueprint, instead of the WidgetBlueprint. e.g.

"Class’/Game/W\_UnitWidget.W\_UnitWidget\_C’

---

<div class="post-metadata">

**Author:** ![BujakD](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BujakD](https://forums.unrealengine.com/u/BujakD)\
**Post date:** [October 2, 2015, 10:46am UTC](https://forums.unrealengine.com/t/packaging-fails-to-package-widget-blueprints-referenced-from-code/333194/4 "2015-10-02T10:46:28Z")

</div>

Hi guys,

thanks for Your answers. Hmm… I think I have found similiar problem, this time with regular blueprint (not UserWidget). Repro steps are almost identical:

1. Create new project based on “first person” c++ example.

2. In content folder create blueprintt (AddNew-\>BlueprintClass), inherit it from Actor and name it BP\_MyBP.

3. Open VS, and go to [ProjectName]Character.cpp file.

4. In constructor at the end add this code:

Remember to put aproppriete widget reference in MyObj contructor.

1. Compile. After hot reload hit play in editor or play in standalone widow. Debug message “blueprint found” appears. Our widget was properly found.
2. Go to File-\>Package project-\>Packageing settings. Check “Full rebuild”
3. Package project (File-\>Package project-\>Widnows-\>Windows 64 bit)
4. After packageing is done go to packaged project and run game
5. Game will prompt that BP\_MyBp was not found

conslusion is that this issue is not limited to Widgets but to all blueprint classes. Most likely the problem here is that code posted here is executed very early and engine maybe not initialized at this point. If I move this code to other consttructor that runs AFTER begin play event it works as expected.

cheers

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b666e59e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b666e59e](https://forums.unrealengine.com/u/anonymous_user_b666e59e)\
**Post date:** [October 2, 2015, 4:08pm UTC](https://forums.unrealengine.com/t/packaging-fails-to-package-widget-blueprints-referenced-from-code/333194/5 "2015-10-02T16:08:29Z")

</div>

This is the same result that Nick mentioned. If you instead use the generated class, everything should work fine.

`static ConstructorHelpers::FObjectFinderMyObj(TEXT("/Game/BP_MyBP.BP_MyBP_C"));`
