So finally, I’ve made my own macro: AsyncLoadClassArray
Basically, it takes an array of soft class references, async load each item in the array, and only returns once ALL have been loaded. Hence acting as a “barrier”.
The actual implementation is the following (debug print code have been stripped in the screenshot):
I use a local variable “load pending” that gets assigned to the number of items in the array once the ForEach loop is completed, and decremented each time an async load is completed. Once the load pending is below zero, we can safely assume everything have been loaded and exit. There is also another local variable to store the result classes.
As you may see, async loads are not waiting for the previous load to be completed, allowing for potential parallelism under the hood. Whether this is really the case is something to be checked though, I don’t know really.
The macro is used like this:
Tested on the Cropout Sample project for the Spawn Data, and it works fine:
I think I have found a bug in UE though: the macro is not marked as “Latent” (no clock icon), even though it use a latent node. This will cause issue if you try to put the macro call in a function. The only way I found to flag the macro as latent was to add an unused latent node in the graph. For some reason, the Async Load Class Asset function does not do the job.