載入資產
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
最后更新于