# When creating a SkeletalMeshComponent in Actor Constructor, why is it null in BeginPlay?

**URL:** <https://forums.unrealengine.com/t/when-creating-a-skeletalmeshcomponent-in-actor-constructor-why-is-it-null-in-beginplay/381819>\
**Category:** Character & Animation\
**Tags:** actor, unreal-engine, skeletalmesh, UE4, question, CPP\
**Created:** [January 14, 2017, 4:55am UTC](https://forums.unrealengine.com/t/when-creating-a-skeletalmeshcomponent-in-actor-constructor-why-is-it-null-in-beginplay/381819 "2017-01-14T04:55:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pteronix](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pteronix](https://forums.unrealengine.com/u/Pteronix)\
**Post date:** [January 14, 2017, 4:55am UTC](https://forums.unrealengine.com/t/when-creating-a-skeletalmeshcomponent-in-actor-constructor-why-is-it-null-in-beginplay/381819/1 "2017-01-14T04:55:44Z")

</div>

I am using the following code to load a Skeletal Mesh into a Skeletal Mesh Component, then load an Animation Blueprint into it. But when I run this, BeginPlay prints “FirstPersonMesh is null” instead of loading the AnimInstance. I’m not sure why this would be the case, since it appears to be loaded just fine in the constructor, but then becomes null before BeginPlay is called.

- Thanks

---

<div class="post-metadata">

**Author:** ![Sean\_Flint](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Sean\_Flint](https://forums.unrealengine.com/u/Sean_Flint)\
**Post date:** [January 17, 2017, 8:11pm UTC](https://forums.unrealengine.com/t/when-creating-a-skeletalmeshcomponent-in-actor-constructor-why-is-it-null-in-beginplay/381819/2 "2017-01-17T20:11:45Z")

</div>

Hey Pteronix,

Instead of `FirstPersonMesh = NewObject(this, TEXT("BaseActor"));`

Let’s try using:

```
FirstPersonMesh = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("BaseActor));

```

New Object is typically used outside of the constructor, meaning if you wanted to create a component at runtime.

Let me know if that makes a difference.
