i’m using cocos creator 3.7.0
i wrote a little code to load asset texture from resource.
var tex = Array(25).fill(new Texture2D());
for(let j = 0; j < 25; j++){
let url = "image/item48-"+j.toString()+"/texture";
resources.load(url,Texture2D,null,(e, s)=>{
tex[j] = s;
});
}
console.log(tex);
then create node and set sriteframe texture from tex array
for(let i = 0; i< this.col; i ++)
{
for(let j = 0; j < this.row; j++){
if(this.val[i][j] != 0 ){
let l = new Node;
this.node.insertChild(l,cnt);
this.label[i][j] = l.addComponent(Sprite);
const sf = new SpriteFrame();
sf.texture = tex[0];
this.label[i][j].spriteFrame = sf;
l.setPosition(this.start_X + this.width*(i+1/2), this.start_y + this.height*(j+1/2));
cnt ++;
}
}
when run it show error : debug.ts:103 Sampler binding ‘cc_spriteTexture’ at set 2 binding 12 index 0 is not bounded
how fix it ?
Sorry for my english!