API reference
API reference
Select your platform
No SDKs available
No versions available

NetworkedAssetLoader

NetworkedAssetLoader

object NetworkedAssetLoader
Singleton for downloading and caching remote assets.
Manages the fetching of remote assets and caches them locally to avoid redundant downloads. Must be initialized with init before use.
Example usage:
// Initialize the loader
NetworkedAssetLoader.init(File(applicationContext.getCacheDir().canonicalPath), OkHttpAssetFetcher())

// The ECS will use the networkedAssetLoader to download files that start with "http" and "https"
val modelUrl = Uri.parse("https://example.com/model.glb")
entity.setComponent(Mesh(modelUrl))

Properties

NameSummary
TAG
const val TAG: String

Functions

NameSummary
init
fun init(downloadDirectory: File, assetFetcher: AssetFetcher)

Initializes the loader with a download directory and asset fetcher.
requestAsset
fun requestAsset(url: <Error class: unknown class>, extension: String): CompletableFuture<String>

Requests an asset from a remote source.
Did you find this page helpful?
Thumbs up icon
Thumbs down icon