Help with using PreloadAsync

Hello,

I am trying to use PreloadAsync to preload a texture, but it doesnt seem to work correctly. When I use this example from ContentProvider | Documentation - Roblox Creator Hub, it works correctly and the function Load is called:

local ContentProvider = game:GetService("ContentProvider")
 
local function Load(contentID, status)
	print("loaded")
end

local logoId = "rbxassetid://658743164"
local pageTurnId = "rbxassetid://12222076"
 
local decal = Instance.new("Decal")
decal.Texture = logoId
 
local sound = Instance.new("Sound")
sound.SoundId = pageTurnId
 
local assets = { decal, sound }
 
ContentProvider:PreloadAsync(assets,Load)

However, if I change it to be local assets = { decal } , the function is not called. Conversely, if I change it to be local assets = { sound } it is called.

I do not fully understand how to use PreloadAsync, and the documentation has not been much help. Could anyone explain why this is happening?

I don’t believe it’s a problem, it is probably yielding. Did you wait for 10-15 seconds when you did local assets = {decal}?

I’ve waited quite a while and nothing happens. But I have come across some strange behaviour. If I put a print statement in the same script, once I click on it in the output window, the asset loads:

It seems like it is still yielding. You used spawn to run the next line of code which is the print.

Yeah it does yield. But why would clicking on the print output cause the callback function to be called suddenly? And should it take so long to load?

Are you sure it is not a coincidence? Maybe you clicked it at a perfect time.

Definitely not, every single time I click it, the load function is called - whether I wait a minute or 2 seconds