Hey devs,
Today I encountered an issue when I was using ContentProvider:PreloadAsync() to preload animations for the game. It never gave a response, no errors, no messages of succeeding, nothing at all.
Here is the related code snippet:
local CP = game:GetService("ContentProvider")
local Debris = game:GetService("Debris")
CP.AssetFetchFailed:Connect(function(assetId)
warn("AssetFetchFailed: "..assetId)
end)
local modules = {} :: {[string]: {string}} do
for i, v in script:GetChildren() do
if v:IsA("ModuleScript") then
modules[v.Name] = require(v)
end
end
end
local toLoadAssets = {} do
for category, items in pairs(modules) do
for _, assetId in items do
if category == "Animation" then
local anim = Instance.new("Animation")
anim.AnimationId = assetId
table.insert(toLoadAssets, assetId)
end
end
end
end
print(toLoadAssets)
local startTime = os.clock()
CP:PreloadAsync(toLoadAssets, function(assetId, status)
print("PreloadAsync() resolved asset ID:", assetId)
print("PreloadAsync() final AssetFetchStatus:", status)
end)
print("Assets preloading completed. Time used: "..os.clock() - startTime)
I was trying to preload animations, it seemingly stuck without printing anything.
Are animations incompatible with ContentProvider:PreloadAsync() or something else?
Any help is appreciated!