Author Topic: Perfectly Aligning UISprites..  (Read 2084 times)

drawmaster77

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 21
    • View Profile
Perfectly Aligning UISprites..
« on: April 12, 2014, 04:31:58 AM »
I am trying to draw a equipment tree for my game, and am running into small artifacts when trying to connect separate UISprites to form one solid object. Here's what it looks like:



Now the sprites themselves (parts of the white arrow) were made to perfectly connect together in Photoshop (without anti-aliasing ofc). I've also changed the atlas texture filter mode to Point as opposed to Trilinear. The sprites are not scaled in Unity, it's 1:1 from source art. If you notice it also works everywhere else, only this stripe is visible for some reason..

Is there anything you can recommend to fix this? And yeah I can't use the whole arrow sprite as I am generating the tree at a runtime.

Thanks.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Perfectly Aligning UISprites..
« Reply #1 on: April 12, 2014, 05:07:31 AM »
Assuming everything is pixel perfect here, I would advise making sure that the sprite's dimensions are dividable by two. If they're not, NGUI will add some padding. So if the sprite is 32x17, it will become 32x18. It will still be drawn as 32x17, but the widget size will be 18, not 17.

drawmaster77

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 21
    • View Profile
Re: Perfectly Aligning UISprites..
« Reply #2 on: April 12, 2014, 05:39:28 AM »
sorry small correction, I did not change the scale itself, but I adjusted dimensions of the sprite (sprite.width/sprite.height)

I've noticed this artifact seems to happen only when shrinking not so much with stretching. So I modified my source art to be 1 pixel wide and just stretched it to desired length. It seems to align perfectly now, even in editor I can zoom in and not see any gaps.

Thanks.