In the example below, we see how the AssetLoader is injected and used in the onInit method to get a model by name.
import { Actor, AssetLoader, BaseActor, inject } from "@hology/core/gameplay";
@Actor()
class TestActor extends BaseActor {
assets = inject(AssetLoader)
async onInit() {
const model = await this.assets.getModelByAssetName('enterNameHere')
this.object.add(model.scene)
}
}
getModelByAssetName(name: string): { scene, animations }
getModelByAssetId(id: string): { scene, animations }
getTextureByAssetName(name: string): Texture
getTextureByAssetId(id: string): Texture
getMaterialByAssetId(id: string): Material