Cocos Creator spine动态换纹理

Cocos Creator spine动态换纹理,我这边使用了一个图集,替换后,图集全部显示出来了,怎么试用图集中的某个图片替换?我写了这么多,发帖还爆Title 无效;请描述得更详尽些
下面是spine的纹理替换代码,下面截图是贪吃蛇,中间是替换的纹理,

var skeleton = this.spine.getComponent(sp.Skeleton)
var slot = skeleton.findSlot('swk3')
var atlas = window.facade.snakeImage
var frame = atlas.getSpriteFrame('body1')

var attachment = slot.getAttachment()
var texture = frame.getTexture()
var tex = new sp.SkeletonTexture({ width: texture.getPixelWidth(), height: texture.getPixelHeight() })
tex.setRealTexture(texture)
attachment.region.texture = tex

slot.setAttachment(attachment)

1赞

这俩图是spine源文件,要替换的图集文件

1赞

大佬 ,这句报错了

后面怎么实现的