Open Asterune
AssetService

AssetService

Load models and preload content assets.

Service
game:GetService("AssetService")
Inherits
Instance
Replication
Never

Behavior

AssetService provides asset loading and caching operations. Asset requests may yield. Content identifiers may use astassetid://, rbxassetid://, astasset://, rbxasset://, http://, or https:// forms.

Summary

Members5
Methods5

Methods

CreateEditableImage

AssetService:CreateEditableImage(options: { Size: Vector2? }?): EditableImage

Creates an EditableImage. The optional Size entry specifies its pixel dimensions.

GetExecutionGroup

AssetService:GetExecutionGroup(): ExecutionGroup?

Returns this instance if it is an ExecutionGroup. Otherwise returns the nearest ancestor ExecutionGroup, or nil when no group contains the instance.

GetPendingShaderCount

AssetService:GetPendingShaderCount(): number

Returns the number of shaders waiting for compilation.

GetStatus

AssetService:GetStatus(content: string): EnumItem

Returns an Enum.AssetStatus value for a content identifier. It reports whether the asset is not requested, loading, loaded, or failed.

Preload

AssetService:Preload(contentIds: { string | Instance }, callback: ((contentId: string, status: EnumItem) -> ())?): ()

Requests one or more content identifiers and yields until all uncached requests in the batch finish. Duplicate identifiers are requested once. A batch may contain up to 1,024 identifiers.

Inherited members

Inherited47

Example

Luau
local assets = game:GetService("AssetService")
assets:Preload({ "astassetid://10", "astassetid://20" })
local status = assets:GetStatus("astassetid://10")

Enum.AssetStatus · Model