• Editor
  • Scale and transparency

Few questions that I couldn't find solutions to.

  1. In Unity you can set 'scale' for sprites. For example currently I have 1 unit = 80 pixels. Is there a way for me to tell Unity what size the spine texture should display as because right now my characters are coming out extremely large.

  2. The 2nd issue could be related. I changed the material from Texture/Diffuse to Spine/Skeleton and the transparency got very 'dirty'. I have a feeling it's because the characters are scaled down to 0.001575 as oppose to being 1.

Any help regarding this would be greatly appreciated, I'm out of options.

Related Discussions
...
  • Düzenlendi

(1) Select the SkeletonData asset in the project panel. The inspector should show a "Scale" field. Set that number to 0.01 if you want a 1:100.

1:80 should be something like 0.0125, I guess.

It might take a while to update or something. Try running your game if the changes don't show up immediately.

(2) The Spine/Skeleton shader is a premultiplied alpha blending shader. To use it, the image you use needs to have a premultiplied alpha as well. In normal image viewers, an image with premultiplied alpha will look weird around its transparent edges since it will look like it has black borders. But it should look perfectly clean in-game.

This premultiply alpha setting will usually be found in the settings when you pack your atlas.

  1. Thank you both for this. That works very well.

  2. I checked the "Premultiply Alpha' option when exporting my files from spine, but this still occurs. In the preview, the alphas look very clean (or with other material types), but not with the Spine/Skeleton and not in game. Have I missed anything else here?

Can you post a screenshot of what it looks like in-game?

Could it be that your textures are just compressed? Unity imports textures as compressed by default. You have to set it to TrueColor for every image you add to your project.

If you have your project settings with 2D defaults, it might be that your image was imported as a Sprite, which has a hidden flag to "set alpha as transparency" which tends to mess up the image if you use Spine/Skeleton. It makes the colors bleed into the transparent pixels so it might look like there are bands of colors.

In either case, import the image as a Texture, set the format to Truecolor or uncompressed. If that looks a bit too blurry for you, change the Texture type from Texture to Advanced, then UNCHECK "Generate Mipmaps"

Thank you so much for all the info. I had read somewhere that I should have turned on Alpha is Transparency, and for some reason didn't bother to check that one anymore. That was the main issue, and I also changed the texture to Truecolor, that helped too. Thank you again.