# Runtime skeletal mesh load

**URL:** <https://forums.unrealengine.com/t/runtime-skeletal-mesh-load/273490>\
**Category:** C++\
**Tags:** unreal-engine, Engine-Source-Code, GitHub, UE4-26, question\
**Created:** [January 19, 2022, 11:06am UTC](https://forums.unrealengine.com/t/runtime-skeletal-mesh-load/273490 "2022-01-19T11:06:19Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![nsdfxela](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/nsdfxela/32/473277_2.png) [@nsdfxela](https://forums.unrealengine.com/u/nsdfxela)\
**Post date:** [January 19, 2022, 11:06am UTC](https://forums.unrealengine.com/t/runtime-skeletal-mesh-load/273490/1 "2022-01-19T11:06:19Z")

</div>

Hello!  
We are creating avatars for Metaverse ([avatarsdk.com](http://avatarsdk.com/)), and we usually need to load avatars at runtime to a scene. E.g it is required for AR\VR conferences when we need to add a new unique avatar for a new participant.  
We are trying to load an avatar skeletal mesh model with blendshapes set at runtime in UE 4.26. To accomplish this task, we create and initialize an instance of USkeletalMesh. We call USkeletalMesh-\>RegisterMorphTarget for each blendshape and USkeletalMesh-\>PostLoad() after that. While the resulting model looks good and the morph targets work fine, we do experience a noticeable freeze (~0.5-1 second) while PostLoad is running. This freeze does not occur (or is not noticeable) unless we add any morph targets. Due to USkeletalMesh-\>PostLoad() limitations, it can only be called on the game thread. So loading multiple models at runtime can lead to a terrible user experience for projects like the metaverse or any software that requires runtime avatars to be generated. Is there a way to solve this problem? Are we using the right tools to solve our issue?

---

<div class="post-metadata">

**Author:** ![Natalo77](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Natalo77](https://forums.unrealengine.com/u/Natalo77)\
**Post date:** [January 19, 2022, 1:54pm UTC](https://forums.unrealengine.com/t/runtime-skeletal-mesh-load/273490/2 "2022-01-19T13:54:10Z")

</div>

There’s no way you can load this asynchronously?

---

<div class="post-metadata">

**Author:** ![nsdfxela](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/nsdfxela/32/473277_2.png) [@nsdfxela](https://forums.unrealengine.com/u/nsdfxela)\
**Post date:** [January 19, 2022, 2:06pm UTC](https://forums.unrealengine.com/t/runtime-skeletal-mesh-load/273490/3 "2022-01-19T14:06:30Z")

</div>

No, because USkeletalMesh-\>PostLoad() works only in game thread.

---

<div class="post-metadata">

**Author:** ![Natalo77](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Natalo77](https://forums.unrealengine.com/u/Natalo77)\
**Post date:** [January 19, 2022, 2:08pm UTC](https://forums.unrealengine.com/t/runtime-skeletal-mesh-load/273490/4 "2022-01-19T14:08:07Z")

</div>

You’re absolutely sure that you can’t use [this?](https://docs.unrealengine.com/4.27/en-US/ProgrammingAndScripting/ProgrammingWithCPP/Assets/AsyncLoading/)

---

<div class="post-metadata">

**Author:** ![nsdfxela](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/nsdfxela/32/473277_2.png) [@nsdfxela](https://forums.unrealengine.com/u/nsdfxela)\
**Post date:** [January 19, 2022, 4:57pm UTC](https://forums.unrealengine.com/t/runtime-skeletal-mesh-load/273490/5 "2022-01-19T16:57:12Z")

</div>

Yes. Let me elaborate: this article describes loading assets, but models we need to load may not even exist at time the application starts. An avatar model may be generated later and we need to display it at runtime. Procedural mesh could be a solution but it doesn’t support skeletal animations and the performance is also a question.

---

<div class="post-metadata">

**Author:** ![midgunner66](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/midgunner66/32/466711_2.png) [@midgunner66](https://forums.unrealengine.com/u/midgunner66)\
**Post date:** [January 19, 2022, 6:50pm UTC](https://forums.unrealengine.com/t/runtime-skeletal-mesh-load/273490/6 "2022-01-19T18:50:02Z")

</div>

You can load new assets at runtime:

> [@](#):
>
> If you need to get a list of the assets, you can use the [asset registry](https://docs.unrealengine.com/4.27/en-US/BlueprintAPI/AssetRegistry/) to scan for and get the assets. [This is a twitter thread about that.](https://mobile.twitter.com/milkyengineer/status/1254999616879071232)

This is code I made that loads user-added sounds at runtime and plays a random one:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/3X/f/f/ff77e7e35e205373cfb077e9d20a0db6269105fe.jpeg)  
Assets can even be added to the game directory at runtime (i.e. they don’t need to exist at game startup).

---

<div class="post-metadata">

**Author:** ![nsdfxela](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/nsdfxela/32/473277_2.png) [@nsdfxela](https://forums.unrealengine.com/u/nsdfxela)\
**Post date:** [January 20, 2022, 5:25am UTC](https://forums.unrealengine.com/t/runtime-skeletal-mesh-load/273490/7 "2022-01-20T05:25:51Z")

</div>

Thanks a lot, I’ll take a look

---

<div class="post-metadata">

**Author:** ![nsdfxela](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/nsdfxela/32/473277_2.png) [@nsdfxela](https://forums.unrealengine.com/u/nsdfxela)\
**Post date:** [January 24, 2022, 1:13pm UTC](https://forums.unrealengine.com/t/runtime-skeletal-mesh-load/273490/8 "2022-01-24T13:13:11Z")

</div>

Yep it really works. At first had problem with filter (search returned nothing) but removing the empty parameter arrays/sets solves it. Now I wonder if it is possible to generate .uasset files without working Editor instance. Let’s say if I have skeletal mesh already loaded in UE shipped app, is there any way to export it to the disk?

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/3X/c/d/cd06021a7d275d174fcd2104dbb1610cbdbefc10.jpeg)

---

<div class="post-metadata">

**Author:** ![midgunner66](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/midgunner66/32/466711_2.png) [@midgunner66](https://forums.unrealengine.com/u/midgunner66)\
**Post date:** [January 25, 2022, 2:41am UTC](https://forums.unrealengine.com/t/runtime-skeletal-mesh-load/273490/9 "2022-01-25T02:41:59Z")

</div>

> [@nsdfxela](#):
>
> Now I wonder if it is possible to generate .uasset files without working Editor instance.

I have no idea, but a very quick skim through the source docs makes me think _maybe,_ but you’d have to look into that.

> [@nsdfxela](#):
>
> Let’s say if I have skeletal mesh already loaded in UE shipped app, is there any way to export it to the disk?

If you mean like for downloading another user’s avatar, then you could probably just send the .uasset file itself to the user rather than exporting from the game.

---

<div class="post-metadata">

**Author:** ![Natalo77](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Natalo77](https://forums.unrealengine.com/u/Natalo77)\
**Post date:** [January 25, 2022, 9:40am UTC](https://forums.unrealengine.com/t/runtime-skeletal-mesh-load/273490/10 "2022-01-25T09:40:23Z")

</div>

Surely the uassets get packed during .exe packaging?

---

<div class="post-metadata">

**Author:** ![midgunner66](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/midgunner66/32/466711_2.png) [@midgunner66](https://forums.unrealengine.com/u/midgunner66)\
**Post date:** [January 26, 2022, 2:22am UTC](https://forums.unrealengine.com/t/runtime-skeletal-mesh-load/273490/11 "2022-01-26T02:22:06Z")

</div>

You can package a game without the assets getting packaged into a pak. But you could probably get away with just copying the usassets straight from the project (like in asset migration).

---

<div class="post-metadata">

**Author:** ![nsdfxela](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/nsdfxela/32/473277_2.png) [@nsdfxela](https://forums.unrealengine.com/u/nsdfxela)\
**Post date:** [January 26, 2022, 4:06pm UTC](https://forums.unrealengine.com/t/runtime-skeletal-mesh-load/273490/12 "2022-01-26T16:06:31Z")

</div>

> [@](#):
>
> But you could probably get away with just copying the usassets straight from the project (like in asset migration).

Yes, this is the hard thing: now I need a way to generate uassets from source 3d-model to wrap it later into .pak. As for now my experiments show there is no way to do that without running instance of Editor. If the uasset is generated, we can copy it from the project.

---

<div class="post-metadata">

**Author:** ![midgunner66](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/midgunner66/32/466711_2.png) [@midgunner66](https://forums.unrealengine.com/u/midgunner66)\
**Post date:** [January 27, 2022, 1:45am UTC](https://forums.unrealengine.com/t/runtime-skeletal-mesh-load/273490/13 "2022-01-27T01:45:22Z")

</div>

There’s [FPakFile | Unreal Engine Documentation](https://docs.unrealengine.com/4.27/en-US/API/Runtime/PakFile/FPakFile/), which is in the runtime module, so may be usable at runtime, but I don’t know. But if you’re trying to keep users from copying the model from the game directory, there are still programs that can open .pak files, so you may need more.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_73094a6c1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_73094a6c1](https://forums.unrealengine.com/u/anonymous_user_73094a6c1)\
**Post date:** [March 27, 2022, 9:58pm UTC](https://forums.unrealengine.com/t/runtime-skeletal-mesh-load/273490/14 "2022-03-27T21:58:19Z")

</div>

This is for WAV files only, correct?

---

<div class="post-metadata">

**Author:** ![midgunner66](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/midgunner66/32/466711_2.png) [@midgunner66](https://forums.unrealengine.com/u/midgunner66)\
**Post date:** [March 28, 2022, 2:49am UTC](https://forums.unrealengine.com/t/runtime-skeletal-mesh-load/273490/15 "2022-03-28T02:49:59Z")

</div>

No, that’s just what I decided to filter for (and [SoundWave](https://docs.unrealengine.com/4.27/en-US/API/Runtime/Engine/Sound/USoundWave/) refers to the class, not the file type). You can get any & all assets if you want. You can use [Get Assets by Path](https://docs.unrealengine.com/4.27/en-US/BlueprintAPI/AssetRegistry/GetAssetsbyPath_InterfaceCall/) to get all in a path.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_73094a6c1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_73094a6c1](https://forums.unrealengine.com/u/anonymous_user_73094a6c1)\
**Post date:** [March 28, 2022, 2:54am UTC](https://forums.unrealengine.com/t/runtime-skeletal-mesh-load/273490/16 "2022-03-28T02:54:17Z")

</div>

So Get Assets by Path would only return files imported in that folder, or does it just return any file in there?

---

<div class="post-metadata">

**Author:** ![midgunner66](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/midgunner66/32/466711_2.png) [@midgunner66](https://forums.unrealengine.com/u/midgunner66)\
**Post date:** [March 28, 2022, 2:57am UTC](https://forums.unrealengine.com/t/runtime-skeletal-mesh-load/273490/17 "2022-03-28T02:57:50Z")

</div>

It returns all asset files in a folder or subfolders, i.e. .uassets, not .wav, .mp3, etc.

And I just realized you’re looking for regular file types, not .uassets, right? In that case, you will probably need to do it C++. I think there’s a file “finder” or something like that, but I’ve never used it, I’ve only used plugins for stuff like that.

---

<div class="post-metadata">

**Author:** ![midgunner66](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/midgunner66/32/466711_2.png) [@midgunner66](https://forums.unrealengine.com/u/midgunner66)\
**Post date:** [March 28, 2022, 3:31am UTC](https://forums.unrealengine.com/t/runtime-skeletal-mesh-load/273490/18 "2022-03-28T03:31:51Z")

</div>

This is in blueprints: [Find Files](https://docs.unrealengine.com/4.27/en-US/BlueprintAPI/FileUtils/FindFiles/) (and more in [File Utils](https://docs.unrealengine.com/4.27/en-US/BlueprintAPI/FileUtils/)). I think you have to enable a plugin, though, but it’s built-in.

> [@Does the FindFiles node not exist anymore?](https://forums.unrealengine.com/t/does-the-findfiles-node-not-exist-anymore/148184/2):
>
> You need to go to your plugins settings and enable the ‘Blueprint File Utilities’ plugin. Can be found under Built-In\>Blueprints.

I didn’t find it in mine, but it’s probably cuz I’m on an older version.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_73094a6c1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_73094a6c1](https://forums.unrealengine.com/u/anonymous_user_73094a6c1)\
**Post date:** [May 24, 2022, 5:36am UTC](https://forums.unrealengine.com/t/runtime-skeletal-mesh-load/273490/19 "2022-05-24T05:36:10Z")

</div>

Can this method load uassets from someone else’s Unreal Engine project?

I want my end users to be able to create a new unreal engine project, then import their custom skeletal mesh armor or clothing based on my game’s base character nude model. Then they can copy their generated uasset’s into my game’s GameUserContent folder. Then I use your code to load their custom armor onto my characters model. **Would that work?**

```auto
/GameUserContent 
skMesh_Clothing_MadeByBob_InHisOwnUEProject.uasset
skMesh_Armor_MadeBySally_InHerOwnUEProject.uasset
```

Do uassets have unique ID or encryption that make them incompatible with other UE projects that try to use them?

---

<div class="post-metadata">

**Author:** ![aiddun](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@aiddun](https://forums.unrealengine.com/u/aiddun)\
**Post date:** [August 22, 2022, 5:21pm UTC](https://forums.unrealengine.com/t/runtime-skeletal-mesh-load/273490/20 "2022-08-22T17:21:10Z")

</div>

@nsdfxela, did you ever figure this out for skeletal meshes?

[Next page](https://forums.unrealengine.com/t/runtime-skeletal-mesh-load/273490.md?page=2)
