# Load Static Mesh With Path in c++

**URL:** <https://forums.unrealengine.com/t/load-static-mesh-with-path-in-c/292234>\
**Category:** Asset Creation\
**Tags:** unreal-engine, CPP, question\
**Created:** [August 28, 2014, 6:42am UTC](https://forums.unrealengine.com/t/load-static-mesh-with-path-in-c/292234 "2014-08-28T06:42:02Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![staticvoidlol](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@staticvoidlol](https://forums.unrealengine.com/u/staticvoidlol)\
**Post date:** [August 28, 2014, 7:15am UTC](https://forums.unrealengine.com/t/load-static-mesh-with-path-in-c/292234/2 "2014-08-28T07:15:32Z")

</div>

First you will need to create a default subobject in your constructor:

```
mesh = PCIP.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("mesh"));

```

Then, to set the actual mesh to use (can be done from anywhere):

```
UStaticMesh* meshToUse = Cast<UStaticMesh>(StaticLoadObject(UStaticMesh::StaticClass(), NULL, TEXT("pathToYourAssetHere")));

if(meshToUse && mesh)
{
    mesh->SetStaticMesh(meshToUse);
}

```

Please note that you will have to declare “mesh” as a class variable.

---

_[View the full topic](https://forums.unrealengine.com/t/load-static-mesh-with-path-in-c/292234)._
