# UPROPERTY value keeps resetting on every compile

**URL:** <https://forums.unrealengine.com/t/uproperty-value-keeps-resetting-on-every-compile/116576>\
**Category:** C++\
**Tags:** unreal-engine\
**Created:** [September 21, 2018, 2:57pm UTC](https://forums.unrealengine.com/t/uproperty-value-keeps-resetting-on-every-compile/116576 "2018-09-21T14:57:58Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_995592e01](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_995592e01](https://forums.unrealengine.com/u/anonymous_user_995592e01)\
**Post date:** [September 21, 2018, 2:57pm UTC](https://forums.unrealengine.com/t/uproperty-value-keeps-resetting-on-every-compile/116576/1 "2018-09-21T14:57:58Z")

</div>

I’m on 4.20.3.

I have a property exposed in C++ as follows:

UPROPERTY(EditDefaultsOnly)  
TSubclassOf\<AProjectile\> ProjectileBlueprint;

This C++ class is inherited by a Blueprint class where I set this value to a AProjectile Blueprint class. The problem is this value resets to “None” every time I recompile, and I have to go into the Blueprint and set it again.

I’ve tried fixing this multiple by recreating the variables, and components, using different tags, moving it to private/public, but it always resets on every compile even if nothing changed in code.

Is this intended or am I doing something wrong?

---

<div class="post-metadata">

**Author:** ![Nerdsbeware](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/nerdsbeware/32/897578_2.png) [@Nerdsbeware](https://forums.unrealengine.com/u/Nerdsbeware)\
**Post date:** [September 21, 2018, 3:09pm UTC](https://forums.unrealengine.com/t/uproperty-value-keeps-resetting-on-every-compile/116576/2 "2018-09-21T15:09:38Z")

</div>

This does happen. After some research the general consensus seems to be that it won’t happen if you close the editor before compiling.

Also, if i recall, this usually happens if your c++ class is derived from object.h

---

<div class="post-metadata">

**Author:** ![BrUnO\_XaVIeR](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/bruno_xavier/32/1110230_2.png) [@BrUnO\_XaVIeR](https://forums.unrealengine.com/u/BrUnO_XaVIeR)\
**Post date:** [September 21, 2018, 3:11pm UTC](https://forums.unrealengine.com/t/uproperty-value-keeps-resetting-on-every-compile/116576/3 "2018-09-21T15:11:48Z")

</div>

That is pretty much a “permanent bug”.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_995592e01](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_995592e01](https://forums.unrealengine.com/u/anonymous_user_995592e01)\
**Post date:** [September 21, 2018, 3:12pm UTC](https://forums.unrealengine.com/t/uproperty-value-keeps-resetting-on-every-compile/116576/4 "2018-09-21T15:12:14Z")

</div>

I see. Does this happen for all versions of UE4? Seems to be a huge drag to be making sure I have the editor closed before compiling, and then having to reopen the editor again.

---

<div class="post-metadata">

**Author:** ![Nerdsbeware](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/nerdsbeware/32/897578_2.png) [@Nerdsbeware](https://forums.unrealengine.com/u/Nerdsbeware)\
**Post date:** [September 21, 2018, 3:45pm UTC](https://forums.unrealengine.com/t/uproperty-value-keeps-resetting-on-every-compile/116576/5 "2018-09-21T15:45:44Z")

</div>

Yes.

Also happens randomly with blueprint classes that are children of other blueprint classes, though no definite answer on what triggers that.

I typically set my variables in a Data Table and initialize them in my construction script or onBeginPlay. It’s a real pain and semi-complicated process.

---

<div class="post-metadata">

**Author:** ![Jambax](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jambax/32/904177_2.png) [@Jambax](https://forums.unrealengine.com/u/Jambax)\
**Post date:** [September 21, 2018, 5:24pm UTC](https://forums.unrealengine.com/t/uproperty-value-keeps-resetting-on-every-compile/116576/6 "2018-09-21T17:24:39Z")

</div>

It’s a known issue with TSubclassOf variables unfortunately. I raised this a while ago and it’s been on the Issues forum since 4.17… _apparently_ it’s no longer occurring in 4.21

> **[The Unreal Engine Issues and Bug Tracker](https://issues.unrealengine.com/issue/UE-51994)**
>
> Welcome to the Unreal Engine Issue and Bug Tracker. You can check the status of an issue and search for existing bugs. See latest bug fixes too.

Feel free to bump this thread if needs be.  
[https://forums.unrealengine.com/unre…uled-for-a-fix](https://forums.unrealengine.com/unreal-engine/feedback-for-epic/1527261-hot-reload-has-been-virtually-useless-since-4-17-still-not-scheduled-for-a-fix)

---

<div class="post-metadata">

**Author:** ![Bolobolo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/bolobolo/32/88706_2.png) [@Bolobolo](https://forums.unrealengine.com/u/Bolobolo)\
**Post date:** [September 21, 2018, 8:27pm UTC](https://forums.unrealengine.com/t/uproperty-value-keeps-resetting-on-every-compile/116576/7 "2018-09-21T20:27:55Z")

</div>

The issue isn’t specific to TSubclassOf. Whenever you change a header file while the editor is open, all exposed uproperties of the class revert to default.  
[UE-52220](https://issues.unrealengine.com/issue/UE-52220) has been around for more than a year and it’s first thing I look for with every update.  
I don’t know how epic devs work without hotreload because it really destroys productivity.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_995592e01](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_995592e01](https://forums.unrealengine.com/u/anonymous_user_995592e01)\
**Post date:** [September 22, 2018, 12:20am UTC](https://forums.unrealengine.com/t/uproperty-value-keeps-resetting-on-every-compile/116576/8 "2018-09-22T00:20:31Z")

</div>

Is there any way to disable hot reload or is that moot at this point? How has everyone been able to develop with this bug up to now?

Seems like this is a workflow killer or a massive headache unless everyone is just avoiding exposing properties for blueprint totally.

---

<div class="post-metadata">

**Author:** ![Jambax](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jambax/32/904177_2.png) [@Jambax](https://forums.unrealengine.com/u/Jambax)\
**Post date:** [September 22, 2018, 10:28am UTC](https://forums.unrealengine.com/t/uproperty-value-keeps-resetting-on-every-compile/116576/9 "2018-09-22T10:28:27Z")

</div>

Seems like it’s pointer UPROPERTY()'s that get reset then - I haven’t experienced much of that.

You wouldn’t disable hot reload, you just have to restart the project from visual studio. My projects always open pretty quickly, and I haven’t ever trusted hot reload anyway aside from making small CPP changes so I don’t really feel the effects of it.

Live++ works relatively well and it’s way faster. Only works so long as you don’t make changes that require UHT to run though.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_995592e01](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_995592e01](https://forums.unrealengine.com/u/anonymous_user_995592e01)\
**Post date:** [September 22, 2018, 2:28pm UTC](https://forums.unrealengine.com/t/uproperty-value-keeps-resetting-on-every-compile/116576/10 "2018-09-22T14:28:10Z")

</div>

What version are you on TheJamsh?

I’m actually also experiencing other non UPROPERTY values being reset like static meshs, and physics properties. It’s such a time waster to have to hunt down reset values every time there’s a recompile with the Editor running.

---

<div class="post-metadata">

**Author:** ![Jambax](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jambax/32/904177_2.png) [@Jambax](https://forums.unrealengine.com/u/Jambax)\
**Post date:** [September 22, 2018, 3:00pm UTC](https://forums.unrealengine.com/t/uproperty-value-keeps-resetting-on-every-compile/116576/11 "2018-09-22T15:00:27Z")

</div>

4.19 / 4.20 here - but in all honesty I rarely ever use hot reload - only when I’m tweaking or fine-tuning properties. Half the time I find it’s quicker to restart the project and load up a test map then wait for HR to finish 😕

---

<div class="post-metadata">

**Author:** ![Bolobolo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/bolobolo/32/88706_2.png) [@Bolobolo](https://forums.unrealengine.com/u/Bolobolo)\
**Post date:** [September 22, 2018, 5:56pm UTC](https://forums.unrealengine.com/t/uproperty-value-keeps-resetting-on-every-compile/116576/12 "2018-09-22T17:56:40Z")

</div>

> [@Jambax](#):
>
> Live++ works relatively well and it’s way faster. Only works so long as you don’t make changes that require UHT to run though.

What kind of iteration times do you get with Live++ ?

---

<div class="post-metadata">

**Author:** ![Pyro\_GX](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pyro\_GX](https://forums.unrealengine.com/u/Pyro_GX)\
**Post date:** [January 11, 2019, 3:31am UTC](https://forums.unrealengine.com/t/uproperty-value-keeps-resetting-on-every-compile/116576/13 "2019-01-11T03:31:15Z")

</div>

> [@Jambax](#):
>
> It’s a known issue with TSubclassOf variables unfortunately. I raised this a while ago and it’s been on the Issues forum since 4.17… _apparently_ it’s no longer occurring in 4.21
> 
> [Unreal Engine Issues and Bug Tracker (UE-51994)](https://issues.unrealengine.com/issue/UE-51994)
> 
> Feel free to bump this thread if needs be.  
> [https://forums.unrealengine.com/unre…uled-for-a-fix](https://forums.unrealengine.com/unreal-engine/feedback-for-epic/1527261-hot-reload-has-been-virtually-useless-since-4-17-still-not-scheduled-for-a-fix)

This is still definitely happening as of 4.21.1 (Version: 4.21.1-4613538+++UE4+Release-4.21). All I need to do is close and re-open the editor and the TSubclassOf variable is reset to None, every time. It doesn’t matter if I clean out binaries/intermediate, rebuild project files, etc. prior to opening the editor.

---

<div class="post-metadata">

**Author:** ![Jambax](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jambax/32/904177_2.png) [@Jambax](https://forums.unrealengine.com/u/Jambax)\
**Post date:** [January 11, 2019, 9:28am UTC](https://forums.unrealengine.com/t/uproperty-value-keeps-resetting-on-every-compile/116576/14 "2019-01-11T09:28:57Z")

</div>

Doesn’t happen to me if I close and re-open the editor - but I have still seen it happen with Hot Reload.

If it’s happening on close and re-open only then that’s a new bug.

---

<div class="post-metadata">

**Author:** ![Meliko](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Meliko](https://forums.unrealengine.com/u/Meliko)\
**Post date:** [March 29, 2019, 5:07pm UTC](https://forums.unrealengine.com/t/uproperty-value-keeps-resetting-on-every-compile/116576/15 "2019-03-29T17:07:12Z")

</div>

Problem is still here unfortunately ☹

---

<div class="post-metadata">

**Author:** ![arhiDavid](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@arhiDavid](https://forums.unrealengine.com/u/arhiDavid)\
**Post date:** [August 10, 2019, 1:01pm UTC](https://forums.unrealengine.com/t/uproperty-value-keeps-resetting-on-every-compile/116576/16 "2019-08-10T13:01:43Z")

</div>

SOLUTION!!!

Just wanted to share that I seems to have resolved this issue.

When you are making changes to not inherited components and facing issues similar to described above (Component does not save meshes, textures, materials, Projectile classes, etc.) you need to READD problematic component - AND (!) compile blueprint (class) on every step.

[![](https://udemy-images.s3.amazonaws.com/redactor/raw/2019-08-10_12-58-22-eec63fe48ffd4e77c515e94d5fa2a4ce.png) ](https://udemy-images.s3.amazonaws.com/redactor/raw/2019-08-10_12-58-22-eec63fe48ffd4e77c515e94d5fa2a4ce.png)

First time I tried it - it did not work for me because (I think) I have missed second step (Compile after deleting problematic component)

Also I have switched to 4.22 - this issue was still present before I have took steps above.

Take care everyone, and happy developing!

---

<div class="post-metadata">

**Author:** ![Dumbeldor](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dumbeldor](https://forums.unrealengine.com/u/Dumbeldor)\
**Post date:** [March 10, 2020, 10:33pm UTC](https://forums.unrealengine.com/t/uproperty-value-keeps-resetting-on-every-compile/116576/17 "2020-03-10T22:33:34Z")

</div>

@arhiDavid Thanks! Your technique solves the problem 🙂

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_f1f9a1cf](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_f1f9a1cf](https://forums.unrealengine.com/u/anonymous_user_f1f9a1cf)\
**Post date:** [April 2, 2020, 10:57pm UTC](https://forums.unrealengine.com/t/uproperty-value-keeps-resetting-on-every-compile/116576/18 "2020-04-02T22:57:48Z")

</div>

@arhiDavid Thanks mate

---

<div class="post-metadata">

**Author:** ![FidelityRaccoon](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@FidelityRaccoon](https://forums.unrealengine.com/u/FidelityRaccoon)\
**Post date:** [May 17, 2020, 7:25am UTC](https://forums.unrealengine.com/t/uproperty-value-keeps-resetting-on-every-compile/116576/19 "2020-05-17T07:25:36Z")

</div>

> [@arhiDavid](#):
>
> SOLUTION!!!
> 
> Just wanted to share that I seems to have resolved this issue.
> 
> When you are making changes to not inherited components and facing issues similar to described above (Component does not save meshes, textures, materials, Projectile classes, etc.) you need to READD problematic component - AND (!) compile blueprint (class) on every step.
> 
> [https://udemy-images.s3.amazonaws.com:443/redactor/raw/2019-08-10\_12-58-22-eec63fe48ffd4e77c515e94d5fa2a4ce.png](https://udemy-images.s3.amazonaws.com:443/redactor/raw/2019-08-10_12-58-22-eec63fe48ffd4e77c515e94d5fa2a4ce.png)
> 
> First time I tried it - it did not work for me because (I think) I have missed second step (Compile after deleting problematic component)
> 
> Also I have switched to 4.22 - this issue was still present before I have took steps above.
> 
> Take care everyone, and happy developing!

Excuse me sir, i’ve tried your method but unfortunately this doesn’t work when packaging the project to windows, it gives the “PreSave: Null Widget Tree” problem  
thus my solution was just putting default values in the cpp side using the  
FObjectFinder method, if someone has a better solution please let me know so we can evolve our code to be more elegant and sufficient. 🙂

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_04648803](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_04648803](https://forums.unrealengine.com/u/anonymous_user_04648803)\
**Post date:** [June 14, 2020, 2:31pm UTC](https://forums.unrealengine.com/t/uproperty-value-keeps-resetting-on-every-compile/116576/20 "2020-06-14T14:31:21Z")

</div>

@arhiDavid Many thanks bud.

[Next page](https://forums.unrealengine.com/t/uproperty-value-keeps-resetting-on-every-compile/116576.md?page=2)
