Why is everyone itterating ContentProvider:PreloadAsync({obj})

What I do

local ww = workspace:GetDescendants()
ContentProvider:PreloadAsync(ww)

What everyone else does

local ww = workspace:GetDescenants()
for i = 1, #ww, 1 do
      ContentProvider:PreloadAsync({ww[i] })
      -- maybe ui bbar
end

you’re generating a new list just to load 1 object.

Both of them are unnecessary.

The reason for that is so people can detect when individual assets have been loaded, especially useful in loading screens to display the amount of assets loaded.

1 Like

correct me if im wrong but it loads significant slower and… theres zero scenario when i want to know # of assets loaded. I just need a bool : loaded or not loaded

i will mark this as the solution but im not satisfied ;(

Yes, it might load a little slower, but probably not too noticeable depending on memory usage at runtime.

Although you may not have a use for it, others such as me prefer to display the amount of assets loaded. I don’t think this system has any other use than that, though…

so for yours you would just preload the entire thing. Let me know if you have any further questions.

1 Like
local n = 0
ContentProvider:PreloadAsync(ww, function(assetId, assetFetchStatus)
    n += 1
end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.