Aggressor

I recently updated Spine-Unity to the latest version (yay thank you!).

However when I run the SpriteAttacher script and it adds an item at runtime, that item is now getting a white background (in fact some of the background is even appearing yellow light the bottom right part), even though its an alpha image.

Do you know why my sprite is attaching with white space (instead of alpha)? The first image shows its whitespace, and the second shows the sprite settings (where it has alpha).

-- 25 Nov 2015, 01:34 --

Turns out I'm a derp. Forgot I changed the shader!

Changing

loader = new SpriteAttachmentLoader(sprite, Shader.Find("Spine/Skeleton"));


To

loader = new SpriteAttachmentLoader(sprite, Shader.Find("Sprites/Default"));

Fixes it!
Bu mesaja eklenen dosyaları görüntülemek için gerekli yetkilere sahip değilsiniz.
Aggressor
  • Mesajlar: 93

Pharan

Just for extra info: the Spine/Skeleton shader is a PMA (premultiplied alpha) shader.
It requires that your images were saved with premultiplied alpha too, or else the transparent parts won't look right.
More on that here: Premultiply Alpha

Glad to know you found and solved the problem quickly.
Kullanıcı avatarı
Pharan
  • Mesajlar: 5366

Aggressor

One other question I had was on how to set the scale of a SpriteAttacher object?

Do you know how I can scale it up?

I tried setting scaleX on the attachment but to no avail.
Aggressor
  • Mesajlar: 93

Pharan

The SpriteAttacher adds a new Spine.Attachment object to the skeleton based on the Sprite you chose, into the Slot you chose.

Scaling works like it would with the rest of Spine stuff: by scaling its parent bone.

For its base scale, SpriteAttacher also uses the parent Texture import settings' Pixel Per Unit scale.
Kullanıcı avatarı
Pharan
  • Mesajlar: 5366

Aggressor

Ok so the sprite attached with match the scale of the bone. I will keep this in mind thanks.

I mean Im sure its good practice to have them be the same scale, but there are times when I will need to scale this puppy & not the bone 8)
Aggressor
  • Mesajlar: 93

Pharan

Then you give it its own bone and slot and scale that. Again, the SpriteAttacher works as if you added the attachment in Spine. So however attachments work in Spine, that's how it works.

Attachments aren't intended to be scaled at runtime. If you want to animate its scale, scale its bone. If you want to set its base scale, change the Pixel Per Unit of the texture.

On top of that, you can change the attachment's base scale with Attachment. ScaleX and ScaleY, then call attachment.UpdateOffset().
Attachment offset values (including its scale) aren't intended to be animated. Updating them (with UpdateOffset) is more computationally expensive than scaling a bone. Changing it once is fine.
Kullanıcı avatarı
Pharan
  • Mesajlar: 5366


Dön Unity