• Runtimes
  • spine-flutter - change region on an attachment during runtime

Hi,
I'm trying to change a texture region attachment with assets image on a spine model, i want use image in assets but not multiple attachments in Spine.

i have do success int android native or unity, but not find some api in flutter. such in android native:

private fun Slot.changeSlotDisplay(attachmentBitmap: Bitmap) {
val atlasRegion = AtlasRegion(AndroidTexture(attachmentBitmap), 0, 0, attachmentBitmap.width, attachmentBitmap.height)

val originAttachment = this.attachment
when (originAttachment) {
    is MeshAttachment -> {
        originAttachment.region = atlasRegion
        originAttachment.updateRegion()
    }

    is RegionAttachment -> {
        originAttachment.region = atlasRegion
        originAttachment.updateRegion()
    }
}

}

Related Discussions
...

In the Flutter runtime for Spine, it is currently not possible to directly replace an individual attachment's texture or image. However, you can achieve similar results by using Spine's skin feature. This allows you to swap out different images or textures by defining them as part of a skin in Spine and then applying the skin at runtime. You can find more information about using skins in Spine here: Spine Skins.

  • yeyunlin ответили на это сообщение.

    Spinebot
    Thank you for your reply,

    While the skin feature does allow for similar functionality, it lacks flexibility. For example, my character model has dozens or even hundreds of outfits, and more will be continuously updated in the future. However, it's not practical to define all of them as skins.

    As Spinebot said, that's currently not possible. I've opened an issue here:
    EsotericSoftware/spine-runtimes2859

    We are currently in the process of finalizing Spine 4.3, which requires porting changes to all runtimes. It will take some time before we can throw resources at this Flutter feature.

    • yeyunlin ответили на это сообщение.

      Mario OK, looking forward to seeing this feature updated soon!