Async Load Asset node not working asynchronously?

Ok, given that the node “Async Load Asset” should be asynchronous (the clock icon on the right upper corner confirm that) it could be used to preload heavy assets in convenient moment of the game, right?

I also checked the Async Loading Thread checkbox in the project settings.

I made a test with an empy level containing just a cube with a color changing material so i can tell if it glitches, and pressing the spacebar i trigger 3 async asset loading nodes (screenshot) with a very heavy mesh, a light one and a texture in decreasing size order: i should should see the print messages in reversed/mixed order, right?

Instead, the application freeze while loading the assets, i can see it in the viewport and in the level bp debugger too.

Am i doing something wrong?

The async loads are separate from your game thread, but not separate from each other. The streaming manager takes the async requests and processes them in order. With only one thread available to perform the async loads they will return in the order received.

If multiple loading threads were available they could be processed simultaneously, and loading time of each asset could come into play - but don’t forget that seek and read times are also a factor when streaming from disc, which can slow down all simultaneous loads on all threads rather than being faster than a sequential load.

I’d guess the Sequence node is waiting for a trigger from the AyncLoad->Complete path, rather than the Continue path, to execute the next element in the Sequence; which is why you’re getting the hitch.

I suggest ditching the Sequence node and just chaining the AsyncLoads after the previous PrintString node in one execution path. If you want to queue them at once, chain them after the “loading” PrintString nodes. If you want to wait for one to finish loading before queuing the next, chain them after the “loaded” PrintString nodes

1 Like

I changed the bp to have the assets to be loaded sequentially, but the game still freeze in between the loadings: it freeze during the first, then print and update the view according the mouse movement but the next frame it is freezed again for the second load.

(I made a loop to test an array of arbitrary length of asset to be loaded)

Am i missing something?

What’s in that array?

It looks like it’s gonna make a new array each time you press the spacebar. Depending on what’s in the array, loading those elements may trigger the load - and cause the hitch - rather than the actual asset load request.

Try building that array once in the constructor and storing it in a variable you can access from the keypress. See if that changes the behavior.