Hello Guest

Author Topic: Can't see the animated sprite  (Read 2955 times)

wijesijp

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 10
    • View Profile
Can't see the animated sprite
« on: May 08, 2013, 12:05:16 pm »
I am having hard time understanding how MakePixelPerfect works.

I am trying to add animation to the game. When I add the animated sprite to scene the sprite is very small, can’t even see it. I can re-size the sprite and make it display when the game is running.

Instead of re-sizing the sprite I did following from code;

Code: [Select]
private tk2dAnimatedSprite anim;

void Start ()
{
anim = GetComponentInChildren<tk2dAnimatedSprite>();
anim.MakePixelPerfect();
}

Now I can see the animated sprite, but the scale is still 1,1,1

I also tested the game in different resolutions and the sprite is somehow scaling correctly.  What is the reference it uses to scale to different screen sizes?
My game will run on different screen sizes so do I have to use MakePixelPerfect or scale the sprite myself?
« Last Edit: May 08, 2013, 12:10:59 pm by wijesijp »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Can't see the animated sprite
« Reply #1 on: May 08, 2013, 12:28:49 pm »
In most cases you don't have to call MakePixelPerfect.

If you create the sprite with the correct sprite collection settings, it will be pixel perfect at the resolution & ortho settings.
So if you create a sprite collection with target height = 640, and ortho size = 10 -
Any sprites you create from this collection will display pixel perfect automatically when displayed at any resolution with 640 height, and in an orthographic camera with 10 height.

So if the resolution changes, instead of changing the sprite sizes, and messing about with all that, just change the camera orthographic size to compensate and make it always pixel perfect.