As, the title said. How do I check if an object that I put in PreloadAsync is success?
Like it receives an object array and function that will run every time an object is finished loaded. The problem with that function is, it still runs even the object is failed to load and automatically skips to load the other object in the array. Which is good, but I want to prevent it in case if that object is not successfully loaded.
So, yeah any way to know if the object is successfully loaded? Each by each? Thanks in advance
1 Like
So, how do I check whether an object is success to load or not success?
There’s a sample code at the bottom there. Plus, you can wrap the PreloadAsync inside a pcall(). So, for example:
local success, err = pcall(function()
ContentProvider:PreloadAsync({Item1, Item2})
end)
if success then
-- Remember, success is always a bool.
end
the function passed to PreloadAsync has 2 params.
First one is the thing that got preloaded and a Enum telling you if it was a success
local function preload(asset, status)
-- if loading was a success then status will be Enum.AssetFetchStatus.Success
end
1 Like
wow, thanks a lot. I not sure if I missed a page but never know that the callback function can return some variable.