# Component Created in C++ is destroyed before BeginPlay

**URL:** <https://forums.unrealengine.com/t/component-created-in-c-is-destroyed-before-beginplay/454545>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [August 28, 2019, 11:33pm UTC](https://forums.unrealengine.com/t/component-created-in-c-is-destroyed-before-beginplay/454545 "2019-08-28T23:33:18Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![JediKnightChan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jediknightchan/32/1156960_2.png) [@JediKnightChan](https://forums.unrealengine.com/u/JediKnightChan)\
**Post date:** [December 3, 2022, 10:47pm UTC](https://forums.unrealengine.com/t/component-created-in-c-is-destroyed-before-beginplay/454545/9 "2022-12-03T22:47:52Z")

</div>

It is not an issue of GAS, it’s a common UE issue thay are too busy messing with Nanites and other \*\*\*\* to fix

> [@Changing a default subobject name in C++ class leads to UActorComponent being marked as PendingKill immediately after being instantiated when loading from .uasset, and is eventually reset to NULL by GC](https://forums.unrealengine.com/t/changing-a-default-subobject-name-in-c-class-leads-to-uactorcomponent-being-marked-as-pendingkill-immediately-after-being-instantiated-when-loading-from-uasset-and-is-eventually-reset-to-null-by-gc/480745):
>
> Short Description So, I’ve been investigating this bug for quite some time. I have also found several posts on UE forums on this issue. It affects several engine versions – I have personally reproduced it on 4.25.4 and 4.26.1 (using both Launcher version and recompiled from source). The issue happens only with blueprints. There are 2 symptoms I know of: UPROPERTY() component pointer is somehow set to NULL in BeginPlay() though it has been set to a non-NULL object in C++ constructor using Cr…

> [@UPROPERTY member vars reset to NULL by ObjectInitializer](https://forums.unrealengine.com/t/uproperty-member-vars-reset-to-null-by-objectinitializer/19959/17):
>
> 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 the…

---

_[View the full topic](https://forums.unrealengine.com/t/component-created-in-c-is-destroyed-before-beginplay/454545)._
