I have been able to successfully add attachments programmatically. Yay. However, I've noticed that if I add an attachment at runtime and had some things like animated color settings (changing the alpha, for example) that these things don't carry over to the newly attached image. Is there some trick to accomplishing this or is something that isn't possible?
Attachment and slot color settings
- Düzenlendi
You can not animate attachment colors in Spine, you can only animate slot colors. So, as long as you do not modify the slot colors programmatically, your color animations should be in tact.
Sorry. I am animating the slot color. For some reason, if I bring the alpha of the slot to zero and then add a sprite to that slot in the run time, the alpha change does not carry through.
I will have a look at it and will get back to you, have to check this!
Unfortunately I do not get the problem you are describing - I modified the Goblins example in Spine to have colored the left-hand-item
in green and then transparent, and it carries over as desired to the attachments (both the spear and the dagger get transparent as desired). I also saw the same happen in the Spine editor, so nothing unpredicted happened. It also worked with skins.
Does the color not change at all at your sprite, or is only the alpha value not affected?
It is both color and alpha. I initially thought it was the material that I was using for the sprite that I am attaching, but that doesn't seem to be the case. Is there some code example on how to do this you could post so that I can make sure I'm doing it correctly? I've resorted to using skins in the meantime, but I think that, as my attachment option list grows, doing it this way might be more efficient.
Also, looking at the goblins example, those attachments are already part of the spine file, correct? I'm attempting to take a sprite from unity and attach it to the slot in the spine skeleton.
I tried the Unity Sprite attachment on a modified version of the Mix And Match
example scene - it still works, the color and transparency values are changed accordingly.
Did you repackage the atlas as in the MixAndMatch.cs
script of the example scene? Maybe you should give that a try.
I'll give that a shot later today or tomorrow and report back. Thanks!