加载完文件之后你需要把之前加载使用的逻辑放到合并后的文件加载回调中,这样才能使用。
let loaditem = [{ url: "test.zip", type: Laya.Loader.PLFB }]
Laya.loader.load(loaditem, Laya.Handler.create(this, function (res) {
console.log('res,', (typeof res))
Laya.Texture2D.load("res/layabox.png", Laya.Handler.create(null, function (tex: Laya.Texture2D) {
material.albedoTexture = tex;
let item = 'res/layabox.png'
let getres = Laya.loader.getRes(item)
console.log('getres',getres) //这样就能取到了
}));