Author Topic: Different sprites size  (Read 4182 times)

koskeller

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 5
    • View Profile
Different sprites size
« on: February 24, 2014, 04:48:53 PM »
Hi. Why NGIU and Unity (2d project) uses different sprite size? For example, i have sprite 1024x768, and i added it as GameObject with SpriteRenderer, and then i added it as 2D Sprite from NGUI. Look what i got: https://www.dropbox.com/s/x5u0hkg8pcyw07m/Screenshot%202014-02-25%2000.41.40.png

Both have default settings.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Different sprites size
« Reply #1 on: February 24, 2014, 04:59:00 PM »
2d sprites don't use the UIRoot's virtual pixels as it makes them by inversely scaling the resolution.

I'm actually not entirely sure how the 2d sprites determine their size, because you can set things like point size something directly on the sprite asset.

Essentially, you can't count on 2d sprite's size for anything. I think the missized UI2dSprite is because you have the game view in the background; then Unity gets confused about the size of the view and report a weird Screen.height which makes NGUI size it wrong.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Different sprites size
« Reply #2 on: February 24, 2014, 05:00:35 PM »
Both use different virtual pixels. NGUI uses actual screen pixels by default (2 / Screen.height, if the UIRoot is left as "pixel perfect"). The 2D system uses 1/100 by default (and you can change this in options).

koskeller

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: Different sprites size
« Reply #3 on: February 25, 2014, 03:25:33 AM »
It is possible to setup single virtual pixels system?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Different sprites size
« Reply #4 on: February 25, 2014, 01:12:55 PM »
Can you? Sure. Set UIRoot to be Fixed Size and give it a height of 200.