Skip to main content
Version: bleeding-edge ๐Ÿฉธ

๐Ÿ€ Assets

Retrieve Assets Data from Asset Packs

๐Ÿ—ฟStatic ClassClient & Server๐Ÿง‘โ€๐Ÿ’ปAPI Source

๐ŸŽ’ Examplesโ€‹

(Assets.LoadAsync) Loads a Skeletal Mesh before attaching it
Assets.LoadAsync("my-asset-pack::SK_MyHair", AssetType.SkeletalMesh, function(success)
if (success and character:IsValid()) then
character:AddSkeletalMeshAttached("hair", "my-asset-pack::SK_MyHair")
end
end)
(Assets.Precache) Precaches a Static Mesh
Assets.Precache("my-asset-pack::SM_MyStaticMesh", AssetType.StaticMesh)

๐Ÿ—ฟ Static Functionsโ€‹

GetAnimations: table of tableGets a list containing all Animation Assets Keys from an AssetPack
GetAssetPacks: table of tableGets a list containing information about all loaded Asset Packs
GetAssetPath: stringGets the file path of an asset
GetBlueprints: table of tableGets a list containing all Blueprints Assets Keys from an AssetPack
GetMaps: table of tableGets a list containing all Map Asset Keys from an AssetPack
GetMaterials: table of tableGets a list containing all Materials Asset Keys from an AssetPack
GetOthers: table of tableGets a list containing all Other Assets Keys from an AssetPack
GetParticles: table of tableGets a list containing all Particle Assets Keys from an AssetPack
GetSkeletalMeshes: table of tableGets a list containing all Skeletal Mesh Asset Keys from an AssetPack
GetSounds: table of tableGets a list containing all Sound Assets Keys from an AssetPack
GetStaticMeshes: table of tableGets a list containing all Static Mesh Assets Keys from an AssetPack
IsLoaded: booleanReturns if an Asset is already loaded and cached
LoadAsyncLoads an Asset in the background, so spawning or attaching it later does not freeze the game
PrecacheManually adds an Asset to be loaded during the Player's loading screen

GetAnimationsSlowโ€‹

Gets a list containing all Animation Assets Keys from an AssetPack

local ret = Assets.GetAnimations(asset_pack_path)
Parameters
NameTypeDescription
asset_pack_pathstringThe Asset Pack path to get the assets
Returns
TypeDescription
table of tablearray of tables containing all assets and its metadata
Table keys
NameTypeDescription
keystringNo description provided
...anyNo description provided

GetAssetPacksSlowโ€‹

Gets a list containing information about all loaded Asset Packs

local ret = Assets.GetAssetPacks()
Returns
TypeDescription
table of tableList containing information about all loaded Asset Packs
Table keys
NameTypeDescription
NamestringNo description provided
PathstringNo description provided
AuthorstringNo description provided
VersionstringNo description provided

GetAssetPathModerateโ€‹

Gets the file path of an asset

local ret = Assets.GetAssetPath(asset, asset_type)
Parameters
NameTypeDescription
assetstringThe asset reference in the format asset-pack::AssetKey
asset_typeAssetTypeThe Asset Type
Returns
TypeDescription
stringThe file path defined in the Assets.toml

GetBlueprintsSlowโ€‹

Gets a list containing all Blueprints Assets Keys from an AssetPack

local ret = Assets.GetBlueprints(asset_pack_path)
Parameters
NameTypeDescription
asset_pack_pathstringThe Asset Pack path to get the assets
Returns
TypeDescription
table of tablearray of tables containing all assets and its metadata
Table keys
NameTypeDescription
keystringNo description provided
...anyNo description provided

GetMapsSlowโ€‹

Gets a list containing all Map Asset Keys from an AssetPack

local ret = Assets.GetMaps(asset_pack_path)
Parameters
NameTypeDescription
asset_pack_pathstringThe Asset Pack path to get the assets
Returns
TypeDescription
table of tablearray of tables containing all assets and its metadata
Table keys
NameTypeDescription
keystringNo description provided
...anyNo description provided

GetMaterialsSlowโ€‹

Gets a list containing all Materials Asset Keys from an AssetPack

local ret = Assets.GetMaterials(asset_pack_path)
Parameters
NameTypeDescription
asset_pack_pathstringThe Asset Pack path to get the assets
Returns
TypeDescription
table of tablearray of tables containing all assets and its metadata
Table keys
NameTypeDescription
keystringNo description provided
...anyNo description provided

GetOthersSlowโ€‹

Gets a list containing all Other Assets Keys from an AssetPack

local ret = Assets.GetOthers(asset_pack_path)
Parameters
NameTypeDescription
asset_pack_pathstringThe Asset Pack path to get the assets
Returns
TypeDescription
table of tablearray of tables containing all assets and its metadata
Table keys
NameTypeDescription
keystringNo description provided
...anyNo description provided

GetParticlesSlowโ€‹

Gets a list containing all Particle Assets Keys from an AssetPack

local ret = Assets.GetParticles(asset_pack_path)
Parameters
NameTypeDescription
asset_pack_pathstringThe Asset Pack path to get the assets
Returns
TypeDescription
table of tablearray of tables containing all assets and its metadata
Table keys
NameTypeDescription
keystringNo description provided
...anyNo description provided

GetSkeletalMeshesSlowโ€‹

Gets a list containing all Skeletal Mesh Asset Keys from an AssetPack

local ret = Assets.GetSkeletalMeshes(asset_pack_path)
Parameters
NameTypeDescription
asset_pack_pathstringThe Asset Pack path to get the assets
Returns
TypeDescription
table of tablearray of tables containing all assets and its metadata
Table keys
NameTypeDescription
keystringNo description provided
...anyNo description provided

GetSoundsSlowโ€‹

Gets a list containing all Sound Assets Keys from an AssetPack

local ret = Assets.GetSounds(asset_pack_path)
Parameters
NameTypeDescription
asset_pack_pathstringThe Asset Pack path to get the assets
Returns
TypeDescription
table of tablearray of tables containing all assets and its metadata
Table keys
NameTypeDescription
keystringNo description provided
...anyNo description provided

GetStaticMeshesSlowโ€‹

Gets a list containing all Static Mesh Assets Keys from an AssetPack

local ret = Assets.GetStaticMeshes(asset_pack_path)
Parameters
NameTypeDescription
asset_pack_pathstringThe Asset Pack path to get the assets
Returns
TypeDescription
table of tablearray of tables containing all assets and its metadata
Table keys
NameTypeDescription
keystringNo description provided
...anyNo description provided

IsLoadedOptimalโ€‹

Returns if an Asset is already loaded and cached

An Asset counts as loaded once an entity, an attached mesh or Assets.LoadAsync loaded it during this session, as the type it was loaded as

local ret = Assets.IsLoaded(asset_path, asset_type)
Parameters
NameTypeDescription
asset_pathstringThe asset reference in the format asset-pack::AssetKey
asset_typeAssetTypeThe Asset Type
Returns
TypeDescription
booleanIf the asset is loaded

LoadAsyncOptimalโ€‹

Loads an Asset in the background, so spawning or attaching it later does not freeze the game

Entities and attached meshes load their assets right away when created, which can freeze the game for a moment when the asset is big or many are created at once (e.g. dressing several Characters with AddSkeletalMeshAttached).

The asset stays loaded and cached afterwards. Loading the same asset again while it is still loading waits for the same request. The callback always runs on a later tick, never inside this call, even when the asset was already loaded

Assets.LoadAsync(asset_path, asset_type, callback?)
Parameters
NameTypeDescription
asset_pathstringThe asset reference in the format asset-pack::AssetKey
asset_typeAssetTypeThe Asset Type
callback?functionCalled when the asset finished loading with this format Default nil
Examples (1)
Loads a Skeletal Mesh before attaching it
Assets.LoadAsync("my-asset-pack::SK_MyHair", AssetType.SkeletalMesh, function(success)
if (success and character:IsValid()) then
character:AddSkeletalMeshAttached("hair", "my-asset-pack::SK_MyHair")
end
end)

PrecacheOptimalโ€‹

Manually adds an Asset to be loaded during the Player's loading screen

Assets.Precache(asset_path, asset_type)
Parameters
NameTypeDescription
asset_pathstringThe Asset Key
asset_typeAssetTypeThe Asset Type
Examples (1)
Precaches a Static Mesh
Assets.Precache("my-asset-pack::SM_MyStaticMesh", AssetType.StaticMesh)