勾选延时加载的预制包含压缩纹理 会导致所引用的压缩纹理不显示

  • Creator 版本:2.2.1

  • 目标平台:使用纹理压缩的平台

texture-util.js文件 postLoadTexture方法 中跳过了Loader过程 会导致Loader过程中loader.js绑定的loadPKMTex等方法 不被执行 加载后返回的image是一个Uint8Array
而正常的加载返回的结构
let etcAsset = {
_data: etcData,
_compressed: true,
width: width,
height: height
};

// load image
cc.loader.load({
url: texture.url,
// For image, we should skip loader otherwise it will load a new texture
skips: [‘Loader’], // 跳过了Loader过程
}, function (err, image) {
if (image) { // 压缩纹理时 这里image是Uint8Array
if (CC_DEBUG && image instanceof cc.Texture2D) {
return cc.error(‘internal error: loader handle pipe must be skipped’);
}
if (!texture.loaded) {
texture._nativeAsset = image; // image结构错误 传递给ccTexture2d就不走initWithData 而是 initWithElement
}
}
callback && callback(err);
});