resources.load(TOOLS[0].picUrl, (err, imageAsset: ImageAsset) => {
if (err) {
console.error('get SpriteFrame failed! err:' + err);
return;
}
let spriteFrame = new SpriteFrame();
let texture = new Texture2D();
texture.image = imageAsset;
spriteFrame.texture = texture;
(this.node.getComponent(Sprite) as Sprite).spriteFrame = spriteFrame;
});
creator3.x 动态加载图片
最新推荐文章于 2024-09-21 17:42:40 发布