Load assets
Basic Usage
import { Actor, AssetLoader, BaseActor, inject } from "@hology/core/gameplay";
@Actor()
class TestActor extends BaseActor {
private assets = inject(AssetLoader)
async onInit() {
// Load a model by name
const model = await this.assets.getModelByAssetName('MyCharacter')
this.object.add(model.scene)
// Play a sound
const audioBuffer = await this.assets.getAudioByAssetName('JumpSound')
// ... use audioBuffer
}
}Loading Methods
Models
Textures
Audio
Materials
Prefabs
Generic Asset Access
Last updated