# Compile error when adding USaveGame class

**URL:** <https://forums.unrealengine.com/t/compile-error-when-adding-usavegame-class/2495470>\
**Category:** C++\
**Tags:** unreal-engine, question, CPP\
**Created:** [May 7, 2025, 1:55pm UTC](https://forums.unrealengine.com/t/compile-error-when-adding-usavegame-class/2495470 "2025-05-07T13:55:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Karyfan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Karyfan](https://forums.unrealengine.com/u/Karyfan)\
**Post date:** [May 7, 2025, 1:55pm UTC](https://forums.unrealengine.com/t/compile-error-when-adding-usavegame-class/2495470/1 "2025-05-07T13:55:44Z")

</div>

UE5.3.2. My WIP project compiles and packages well. When I add a USaveGame class, it stops compiling, giving me error, related to UUserWidget:

CompilerResultsLog: Error: C:\Program Files\Epic Games\UE\_5.3\Engine\Source\Runtime\UMG\Public\Blueprint\UserWidget.h(1567) : error C2665: ‘UUserWidget::CreateWidgetInstance’: no overloaded function could convert all the argument types.

and:  
UserWidget.h(1560): Error C2338 : static\_assert failed: ‘The given OwningObject is not of a supported type for use with CreateWidget.’

Again, without this USaveGame class object, it compiles, packages and works fine.

How can these be related?  
Thank you

---

<div class="post-metadata">

**Author:** ![Karyfan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Karyfan](https://forums.unrealengine.com/u/Karyfan)\
**Post date:** [May 7, 2025, 2:24pm UTC](https://forums.unrealengine.com/t/compile-error-when-adding-usavegame-class/2495470/2 "2025-05-07T14:24:17Z")

</div>

Ok, I found the spot where it stumbles. I create a custom widget as:

> UOrderWidget\* OrderRecord = CreateWidget(PlayerController, OrderWidgetClass);

I changed the OwningObject from PlayerController to GetWorld() and it began compiling. Now it’s:

> UOrderWidget\* OrderRecord = CreateWidget(GetWorld(), OrderWidgetClass);

Still can’t grasp why?

Also, what are in this sense differences between includes:  
#include “UI/Factory/SetProductionWidget.h” and  
#include “Blueprint/UserWidget.h” ?
