AssetInsertManager
Handles the loading of assets on the server and client. This is useful for preloading assets on the server and then using them on the client.
Functions
Preload
This item only works when running on the server. ServerAssetInsertManager:
Preload
(
...:
(
number
|
string
)
) →
{
Promise
}
--
An array of promises resolving with each asset. Can be used in conjunction with Promise.all, Promise.any, etc...
Takes a varargs list of assetIds and preloads them on the server.
local proms = AssetInsertManager:Preload(123456789, 987654321)
Promise.all(proms)
:andThenCall(print, "All assets loaded successfully")
PromiseAsset
Promises a copy of the requested asset. If this is called on the server and the asset is not loaded, it will be preloaded.
AssetInsertManager:PromiseAsset(123456789):andThen(function(asset)
-- do something with the asset copy
end)
AssetIsLoaded
AssetInsertManager:
AssetIsLoaded
(
assetId:
number
|
string
) →
boolean
Checks if an asset is loaded.
GetAsset
Gets a copy of an asset by its assetId if it is loaded.
ClearLoadedAssets
This item only works when running on the server. ServerAssetInsertManager:
ClearLoadedAssets
(
) →
(
)
Clears all loaded assets.