PreloadAsync should return instantly if the asset is already loaded

This page mentions how we can add a timeout to to PreloadAsync to prevent it from yielding indefinitely in the case that an asset is already loaded. However, I’ve had assets take longer to load than three seconds before, so that would return a false positive that the asset was loaded. The only way to circumvent this is to increase the timeout length, but then in the case that it’s already loaded you’re waiting long periods of time for no reason.

PreloadAsync was created because only being able to observe the queue size and having to wait extended periods of time just for a few select assets to load since you couldn’t tell if they were loaded or not was silly. While PreloadAsync is a godsend for unloaded assets, it does the very thing it was created to stop when trying to load assets that have already been loaded. We should not have to wait extended periods of time for a timeout to expire just because we called PreloadAsync on an asset that had already been loaded – we don’t have complete control over preloading since ROBLOX does it automatically for the most part, so it’s not something we can avoid with good practice. PreloadAsync should return instantly if the asset is already loaded.

Speaking of preloading, what happened to Preload/Async(Instance) so we could preload unions? :frowning:

It yields indefinitely???

That is not acceptable behavior imo, it basically makes it unusable for anything practical. I was hoping to have loading icons for images in a shop. Guess that’s not happening.

This is not the case (maybe it once was?). The following code works as expected :

local list = {"http://www.roblox.com/asset/?id=2101148"}
game:GetService("ContentProvider"):PreloadAsync(list)
print("Sucess!")
wait(3)
game:GetService("ContentProvider"):PreloadAsync(list)
print("Sucess2!")

If you can show me a case where it yields indefinitely that is a bug and should be fixed.

It used to be the case.

[quote] This method yields indefinitely if the list is empty or any of the items in the list have been successfully loaded before.

print("before")
game:GetService("ContentProvider"):PreloadAsync({})
print("after")
--> before

game:GetService("ContentProvider"):PreloadAsync({ "rbxassetid://101064872" }) print("done with first call") game:GetService("ContentProvider"):PreloadAsync({ "rbxassetid://101064872" }) print("done with second call") --> done with first call [/quote]

I’m glad it’s not the case anymore though. Someone should probably remove the safe PreloadAsync link from the PreloadAsync page and mark the safe PreloadAsync page for deletion since it’s no longer relevant.

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