This is an overdue thread that I’m creating today due to it being highlighted on a thread created earlier today. Specifically, this was after zeuxcg replied to the thread to add an extra note (which later received the solution and through some tests, I found worked the best out of current loading solutions).
An explanation of how callbackFunction works would be appreciated. As brief as can be, I can offer my own written explanation of the function:
PreloadAsync also takes a callbackFunction argument. When added, the ContentProvider will call this function for each asset that is successfully preloaded. It returns two values:
- The ContentId of the asset that was passed
- An AssetFetchStatus Enum
Something worth noting: the callbackFunction only returns two items, as I specified above. Counting is completely separate and something you have to track yourself. As far as I’ve checked however, PreloadAsync is guaranteed to load your assets in the order you specify (e.g. ipairs) and across your array. Be careful with traversed descendants however. They will expand the content array and offset the accuracy of your counter. I don’t have information on countering this yet.
On another note: an announcement would’ve been nice. Too late for that now though.