If it's only one or a few attachments.
I think current workaround is to implement a similar logic as SpriteAttacher.cs does.
The skeleton doesn't have a reference to a Material but each individual Attachment does. But not directly.
In Spine-Unity, each Attachment
points to an System.Object RendererObject
(upcast AtlasRegion) which points to an AtlasPage
which points to its own System.Object RendererObject
(upcast UnityEngine.Material
).
So what you need to do is:
Get the Attachment object.
Switch out its Object RendererObject
reference to a faux-AtlasRegion and AtlasPage that points to the correct material.
https://github.com/EsotericSoftware/spine-runtimes/blob/master/spine-unity/Assets/spine-unity/SpriteAttacher.cs#L134
Note that SpriteAttacher generates a new Attachment from scratch.
You only need to generate the fake AtlasRegion and AtlasPage so that it can point to the right Material.
Interesting part of the runtime...
As for the glowy thing, Nate uses an FBO and stuff. (Unity implements FBO access as RenderTextures)
I have a suspicion that per-attachment rendering in the Spine editor is very different and makes that much easier compared to in the runtimes, especially Spine-Unity which builds the whole mesh all at once.
I could be wrong.
15 Dec 2015 2:23 pm
Oh, if you needed to attach a NEW attachment, you may need to stick an extra slot in there in the editor, and then do a deep copy of the original Attachment object.