[ad_1]
I’m attempting to vary spriteframe ontouch occasion utilizing the code given in Documentation.
But on faucet the spriteframe goes clean. utilizing CocosCreator 3.5.2
Getting this error on Console.
const self = this;
const url="property/NewImage";
assets.load(url, ImageAsset, (err: any, imageAsset) => {
const sprite = this.getComponent(Sprite);
const spriteFrame = new SpriteBody();
const tex = new Texture2D();
tex.picture = imageAsset;
spriteFrame.texture = tex;
sprite.spriteFrame = spriteFrame;
});
https://docs.cocos.com/creator/3.5/handbook/en/asset/sprite-frame.html?h=body
[ad_2]