我这样写哪里出了问题? 怎么没有监听到加载资源? 求大佬指正
const assetsNode = scene.createElement(xrFrameSystem.XRAssets)
const textures = list.filter(i => i.type === AssetType.VIDEOTEXTURE)
shadowNode.addChild(assetsNode)
// 动态创建添加纹理资源
textures.forEach(i => {
this.loadAssets(i)
})
assetsNode.event.add("progress", event => {
console.log('进度:', event)
})
assetsNode.event.add("loaded", event => {
console.log('资源加载完成', event)
})
async loadAssets(item) {
const scene = this.scene
const videoItem = await scene.assets.loadAsset({
type: item.type,
assetId: item.assetId,
src: item.src,
options: { autoPlay: true, loop: true, abortAudio: false },
})
console.log('videoItem.value:', videoItem.value.texture)
const mat = scene.createMaterial(
scene.assets.getAsset('effect', 'simple'),
{u_baseColorMap: videoItem.value.texture }
);
// 可以将其添加到资源系统中备用
scene.assets.addAsset('material', 'mat2', mat);
}