Currently, it is impossible to determine and prevent errors from assets not loading
We expect assets to load properly but when they don’t it really causes issue and can break an entire game
Suggestions
- AssetService.AssetFailedToLoad event
- Image.AssetFailToLoad property
Why make these inaccessible to developers?
https://developer.roblox.com/en-us/api-reference/function/ContentProvider/GetFailedRequests
https://developer.roblox.com/en-us/api-reference/function/ContentProvider/GetDetailedFailedRequests
and ContentProvider.AssetFetchFailed doesn’t work
Code
ContentProvider.AssetFetchFailed:Connect(function(contentId)
print("AssetFetchFailed", contentId)
end)
ContentProvider:PreloadAsync({ SoundService.Sounds }, function(contentId, AssetFetchStatus)
if AssetFetchStatus == Enum.AssetFetchStatus.Failure then
print("Failed to Preload", contentId)
end
end)
20 Likes
Reviving this because I don’t believe theres still is any way to detect for these errors. If some script is dependent on a particular object existing and that object fails to load, then there might be an indexing into nil error that halts the script, and maybe even the entire game. A single failed asset load does not necessitate breaking the entire game, since most assets are just vanity effects (the game shouldn’t break for a client just because “footstep-sand_sfx” doesn’t load in), and with no way to detect and work around failed assets, scripts are uneccessarily halted.
Bump, I know this topic is very old, however I found a solution to this.
Simply use ContentProvider:GetAssetFetchStatus(), it will return an Enum.AssetFetchStatus.
Example:
local assetStatus = contentprovider:GetAssetFetchStatus(asset)
if assetStatus ~= Enum.AssetFetchStatus.Success then
print(asset, 'failed to load, reason:', assetStatus)
end
1 Like