# Loading static meshes during runtime?

**URL:** <https://forums.unrealengine.com/t/loading-static-meshes-during-runtime/287772>\
**Category:** Asset Creation\
**Tags:** unreal-engine, editor, staticmesh, CPP, question\
**Created:** [July 9, 2014, 6:43pm UTC](https://forums.unrealengine.com/t/loading-static-meshes-during-runtime/287772 "2014-07-09T18:43:10Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Rama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rama/32/882413_2.png) [@Rama](https://forums.unrealengine.com/u/Rama)\
**Post date:** [July 9, 2014, 7:08pm UTC](https://forums.unrealengine.com/t/loading-static-meshes-during-runtime/287772/2 "2014-07-09T19:08:48Z")

</div>

#Dynamic Load Object

I have an in-game editor where I get and set static mesh assets all the time!

Here’s how I do it

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...

please note

If you have a lot of mesh assets to reference that you know before compile time, you should stick them in a .h somewhere like this

```
UPROPERTY(EditDefaultsOnly,BlueprintReadOnly,Category="SM Assets")
UStaticMesh* MySmAsset1;

UPROPERTY(EditDefaultsOnly,BlueprintReadOnly,Category="SM Assets")
UStaticMesh* MySmAsset2;

UPROPERTY(EditDefaultsOnly,BlueprintReadOnly,Category="SM Assets")
UStaticMesh* MySmAsset3;

```

And then use SetStaticMesh directly with that

Reason: During packaging the above references will be carried over correctly.

Reason2: They’re super easy to change at any time without requiring code compile.

Hardcoding asset paths is bad idea cause they will change during packaging and may not get updated.

My Dynamic Load Object is for when you dont know which mesh to load pre-compile time, but the user picks one in game / you maybe randomly choose from a series of meshes

#Video

Here’s a video of my runtime use case!

In the very beginning, I am clicking on different mesh and using my Dynamic Load Object code above to get the mesh asset to build with

🙂

Rama

---

_[View the full topic](https://forums.unrealengine.com/t/loading-static-meshes-during-runtime/287772)._
