# UPROPERTY member vars reset to NULL by ObjectInitializer

**URL:** <https://forums.unrealengine.com/t/uproperty-member-vars-reset-to-null-by-objectinitializer/19959>\
**Category:** C++\
**Tags:** unreal-engine\
**Created:** [January 30, 2015, 3:41pm UTC](https://forums.unrealengine.com/t/uproperty-member-vars-reset-to-null-by-objectinitializer/19959 "2015-01-30T15:41:13Z")\
**Posts on this page:** 1\
**Showing post:** 17

<div class="post-metadata">

**Author:** ![Alchemist\_1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/alchemist_1/32/263274_2.png) [@Alchemist\_1](https://forums.unrealengine.com/u/Alchemist_1)\
**Post date:** [July 27, 2022, 9:29am UTC](https://forums.unrealengine.com/t/uproperty-member-vars-reset-to-null-by-objectinitializer/19959/17 "2022-07-27T09:29:51Z")

</div>

It looks like I figured out what’s going on:  
In order for the properties of components to be saved when loading the level, it is necessary that they are created in the actor constructor, and their CreationMethod must be equal to EComponentCreationMethod::Native (this value is set by default when creating a new component using CrteateDefaultSubobject()).  
If components are created in the OnConstruction() method and their CreationMethod = EComponentCreationMethod::UserConstructionScript, then they are recreated after loading, because when loading, the values of the actor properties are loaded, which causes the re-creation of all the actor components that have CreationMethod = EComponentCreationMethod::UserConstructionScript.

---

_[View the full topic](https://forums.unrealengine.com/t/uproperty-member-vars-reset-to-null-by-objectinitializer/19959)._
