-
Creator 版本: 2.4.9
-
目标平台: Android
-
重现方式:sp.spine.Slot的getAttachment方法
-
首个报错: 返回的attachment对象没有region成员
-
之前哪个版本是正常的: web版正常
-
重现概率: 100%
目的是实现拷贝运行时的spine某个部位的贴图出来用作sprite,比如弓箭手射箭动作有100种对应射出的弓箭贴图有100种,每种弓箭在出手时的角度缩放也都不一样,希望出手时实例化程序子弹时候不穿帮。web版是很容易实现的,方法伪代码如下:
let tex = attachment.region.texture._texture;
let rect = cc.rect(attachment.region.x, attachment.region.y, attachment.region.width, attachment.region.height);
let off = new cc.Vec2(attachment.region.offsetX, attachment.region.offsetY);
let ori_size = new cc.Size(attachment.region.width, attachment.region.height);
let spriteFrame = new cc.SpriteFrame(tex, rect, attachment.region.rotate, off, ori_size);