engineIsAssetLoaded
Client
Tells whether an asset a script made is ready to use.
bool engineIsAssetLoaded(element asset)
Parameters
| Name | Type | Description |
|---|---|---|
| asset | element | A txd, texture (or other image), shader, material, model, drawable or col element. |
Returns
true when it is ready. Raises an error if the element is not a txd, texture, shader, material, model, drawable or col.
A txd is ready once its file is read (engineCreateTxd makes one ready at once), an image once its texture is built, and a shader once it has compiled. A model element is ready while its model is streamed in. A drawable, a col and a material are always ready.
Example
local logo = engineCreateTexture("images/logo.png")
addEventHandler("onClientRender", root, function()
if engineIsAssetLoaded(logo) then
dxDrawImage(20, 20, 128, 128, logo)
end
end)