Original title: bool ContentProdiver:IsLoaded(content)
Discourse wanted me to “be a bit more descriptive” and I couldn’t figure it out.
I have a loading gui with an image background. Since the image might take time to load, I also have the background transparency set to 0 so the player won’t see the game as it’s loading.
Once the game loads I want to fade the background out. If the image is loaded, I’ll make the background invisible and fade the image out. If it isn’t loaded, I’ll remove the image and just fade the background out. But I can’t do this because I don’t know if the image is loaded or not.
I can’t fade both the background and the image because the background and image will blend and look trashy.
There’s a hack around this problem, but having the method would be so much better. no idea why it never got added in the first place even when we got Preload(Async)
local imageLoaded
spawn(function()
ContentProvider:PreloadAsync(image)
imageLoaded = true
end)
function fadeLoadScreen()
if imageLoaded then
background.Visible = false
fadeOutImage()
else
image.Visible = false
fadeOutBackground()
end
end
I shouldn’t have to scrounge and work around APIs to gather data that the ContentProvider should just give me. It’s entirely possible to do what I’m trying to do given the existing API, but that doesn’t mean there isn’t a problem. The problem appears when I try to do something simple and obvious and I have to invoke my knowledge of the entire roblox API in order to accomplish it.
The point is there are a ton of things that take longer to get than they probably should (another example is checking if something is destroyed). I’m not sure ROBLOX considers something like this feature worthy just because it’s slightly more difficult to get.
It would save having to do the workaround code above, which is basically keeping the cache yourself, and that seems ugly. It shouldn’t be necessary to do that when the bookkeeping already exists somewhere internally. I think it’s a good feature request.
Why bother having an image if a user on a slow connection never gets to see it? It would suck to have to wait for the image, of course.
Interesting solution to the problem, and you have a good point about how to fix it. Probably not what you’d see in a AAA game, but they aren’t downloading assets on the fly like a web browser…
I made a proposal for this exact method a few months ago. It got rejected. I think the reasoning behind this is because you can more or less check this using PreloadAsync.