# Async Load Asset is really unstable...

**URL:** <https://forums.unrealengine.com/t/async-load-asset-is-really-unstable/1944700>\
**Category:** Blueprint\
**Tags:** unreal-engine, question\
**Created:** [July 21, 2024, 9:43am UTC](https://forums.unrealengine.com/t/async-load-asset-is-really-unstable/1944700 "2024-07-21T09:43:41Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![turbotanaka](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@turbotanaka](https://forums.unrealengine.com/u/turbotanaka)\
**Post date:** [July 21, 2024, 9:43am UTC](https://forums.unrealengine.com/t/async-load-asset-is-really-unstable/1944700/1 "2024-07-21T09:43:41Z")

</div>

I am trying to replace hard references with soft references for in-game information exchange.  
However, inconsistent results of Async Load Asset loading made everything a mess.  
It’s actually more complicated but rough explanation of the process is, Press the button, send soft references to UI and SaveGame and Model Spawner, Load and Cast if the destination uses a hard reference. SaveGame uses soft references, the UI and spawners use hard references.  
It worked fine when I was running everything with hard references.  
However, after replacing soft reference, assets may not load completely, result in inaccurate UI display and models not spawning.  
It may take a couple of reloads to get it to work as intended, but it’s pointless if it doesn’t work correctly the first time.  
Can someone help me?

---

<div class="post-metadata">

**Author:** ![laggyluk](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@laggyluk](https://forums.unrealengine.com/u/laggyluk)\
**Post date:** [July 21, 2024, 1:14pm UTC](https://forums.unrealengine.com/t/async-load-asset-is-really-unstable/1944700/2 "2024-07-21T13:14:11Z")

</div>

Async loading node has two outputs, upper one continues/leaves node in same frame that it was called (before asset is ready), bottom one continues when the asset finished loading. Make sure you don’t try to use the asset before it finished loading and that’s pretty much it. Don’t rely on delay nodes with this approach as loading times can vary.

---

<div class="post-metadata">

**Author:** ![turbotanaka](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@turbotanaka](https://forums.unrealengine.com/u/turbotanaka)\
**Post date:** [July 21, 2024, 3:09pm UTC](https://forums.unrealengine.com/t/async-load-asset-is-really-unstable/1944700/3 "2024-07-21T15:09:46Z")

</div>

I always use the bottom output and never use a Delay.

---

<div class="post-metadata">

**Author:** ![laggyluk](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@laggyluk](https://forums.unrealengine.com/u/laggyluk)\
**Post date:** [July 21, 2024, 3:19pm UTC](https://forums.unrealengine.com/t/async-load-asset-is-really-unstable/1944700/4 "2024-07-21T15:19:46Z")

</div>

Apparently there’s something wrong with your code, when you say that after couple of reloads it’s working as intended it only means that all the assets are finally in memory so the ‘async load’ completion is instant. My guess is that you are using casts somewhere in code that expect variables to be set but they aren’t yet, due to assets loading.  
For example ui widget is async loading icons before creating compass widget and you try to access compass widget from player pawn’s begin play, without actually waiting for it being created.

---

<div class="post-metadata">

**Author:** ![Auran131](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Auran131](https://forums.unrealengine.com/u/Auran131)\
**Post date:** [July 21, 2024, 4:10pm UTC](https://forums.unrealengine.com/t/async-load-asset-is-really-unstable/1944700/5 "2024-07-21T16:10:12Z")

</div>

you also cant call the AsyncLoad Node before its finished, for instance on a for loop

---

<div class="post-metadata">

**Author:** ![Frenetic](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/frenetic/32/1142542_2.png) [@Frenetic](https://forums.unrealengine.com/u/Frenetic)\
**Post date:** [July 21, 2024, 6:04pm UTC](https://forums.unrealengine.com/t/async-load-asset-is-really-unstable/1944700/6 "2024-07-21T18:04:43Z")

</div>

So you can use the upper-path to just-keep doing work that can progress w/o waiting on the load and then, say, flag a bool, or trigger another dependent process once loading is complete (via the bottom path)?

---

<div class="post-metadata">

**Author:** ![laggyluk](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@laggyluk](https://forums.unrealengine.com/u/laggyluk)\
**Post date:** [July 21, 2024, 7:23pm UTC](https://forums.unrealengine.com/t/async-load-asset-is-really-unstable/1944700/7 "2024-07-21T19:23:45Z")

</div>

exactly

---

<div class="post-metadata">

**Author:** ![turbotanaka](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@turbotanaka](https://forums.unrealengine.com/u/turbotanaka)\
**Post date:** [July 22, 2024, 2:48am UTC](https://forums.unrealengine.com/t/async-load-asset-is-really-unstable/1944700/8 "2024-07-22T02:48:38Z")

</div>

Ok, looks like I need to rethink the whole process.  
I thought that using soft references would just require adding a few steps to hard references, but apparently not.  
Thanks everyone for your help.

---

<div class="post-metadata">

**Author:** ![Auran131](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Auran131](https://forums.unrealengine.com/u/Auran131)\
**Post date:** [July 22, 2024, 5:41am UTC](https://forums.unrealengine.com/t/async-load-asset-is-really-unstable/1944700/9 "2024-07-22T05:41:24Z")

</div>

depending on where it is in your game you can use LoadAssetBlocking, this can cause hitches in your game but is useful for testing

---

<div class="post-metadata">

**Author:** ![turbotanaka](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@turbotanaka](https://forums.unrealengine.com/u/turbotanaka)\
**Post date:** [July 22, 2024, 8:20am UTC](https://forums.unrealengine.com/t/async-load-asset-is-really-unstable/1944700/10 "2024-07-22T08:20:48Z")

</div>

I’ve tried several times but it still doesn’t work.  
Obviously the Completed output is being executed without completing the load.

 ![screenshot (2)](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/f/3/7f3cca438575ac18e54baf947bad7db79bece854.png)  
This is the macro I’m using.  
After confirming that the load is complete, execute the next load.  
This macro is used in one place only and is called only once.  
Although this is wired directly to SpawnActor, there is a low probability that all actors spawned in the array.

---

<div class="post-metadata">

**Author:** ![laggyluk](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@laggyluk](https://forums.unrealengine.com/u/laggyluk)\
**Post date:** [July 23, 2024, 5:24am UTC](https://forums.unrealengine.com/t/async-load-asset-is-really-unstable/1944700/11 "2024-07-23T05:24:37Z")

</div>

From what I can see there are several fail scenarios there.  
Try to make it as an event, debug step by step and when it’s working convert it to macro (if you really need it) and check if it’s still working. Macros can be difficult to debug.

---

<div class="post-metadata">

**Author:** ![turbotanaka](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@turbotanaka](https://forums.unrealengine.com/u/turbotanaka)\
**Post date:** [July 23, 2024, 6:48am UTC](https://forums.unrealengine.com/t/async-load-asset-is-really-unstable/1944700/12 "2024-07-23T06:48:29Z")

</div>

Maybe this is the problem I’m facing…

> [@Async Load Asset malfunctions if called too fast?](https://forums.unrealengine.com/t/async-load-asset-malfunctions-if-called-too-fast/968631):
>
> I have an event which gets a soft reference for skeletal mesh and animation blueprints, and then assigns these to a new actor after it has been spawned. It uses the Async Load Asset node, seen here: If I call this event from input during play, it works correctly. However, if I call this event from a for loop, the first skeletal mesh and animBlueprint are loaded, but subsequent iterations are not. Debug tells me that the correct classes are identified, however for some reason…

That macro was created to accommodate multiple key types.  
I tried running the same thing in an event, but the result was the same.  
I knew that async loading and loops are a bad combination. And maybe that’s the problem.  
This is too difficult for me. I thought I understood it, but something is missing.  
I would like to know how others have solved this problem, but apparently no one else is facing the problem except me.

---

<div class="post-metadata">

**Author:** ![Auran131](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Auran131](https://forums.unrealengine.com/u/Auran131)\
**Post date:** [July 23, 2024, 7:34am UTC](https://forums.unrealengine.com/t/async-load-asset-is-really-unstable/1944700/13 "2024-07-23T07:34:43Z")

</div>

what you do is have an array of pending assets, and you only load the next item when the first is completed.

the possible difference with your marco is what if the macro is called twice? it’ll break the previous load order.

so whenever the event is called to load something it just adds to the pending array

if you need to return a loaded object you can bind to an event

---

<div class="post-metadata">

**Author:** ![laggyluk](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@laggyluk](https://forums.unrealengine.com/u/laggyluk)\
**Post date:** [July 24, 2024, 6:34am UTC](https://forums.unrealengine.com/t/async-load-asset-is-really-unstable/1944700/14 "2024-07-24T06:34:35Z")

</div>

what you can do instead of using for loop is have an array with items to load  
async load last item from array  
when it’s completed, remove last array item  
go from the start until array has zero items

why last item? maybe memory for whole array doesn’t have to be relocated when doing that, like in c++ but it’s only my assumption. you can as well work on first item instead and it will be the same.
