Author Topic: How is Unity Sprite support in NGUI lately?  (Read 6972 times)

Wisteso

  • Full Member
  • ***
  • Thank You
  • -Given: 21
  • -Receive: 3
  • Posts: 103
    • View Profile
How is Unity Sprite support in NGUI lately?
« on: June 03, 2016, 06:26:41 PM »
Currently using an older version of NGUI ( 3.8 ) since we're getting closer to release.

One of the current things that I wish we could do is completely switch to Unity managed sprites instead of NGUI atlases since it offers better compression options and the ability to share data between our "world" and "gui" sections.

Last time I checked, there were still some things that prevented us from doing that.

1) "Pixel Size" behaved oddly compared to NGUI Atlas "Pixel Size" and made it hard to have high/low DPI modes
2) No support for convex meshes, only square

Has anyone had luck with item 1? Is item 2 something that's been added and works pretty well?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How is Unity Sprite support in NGUI lately?
« Reply #1 on: June 04, 2016, 02:43:37 PM »
2. NGUI lets you create your own custom widget types by creating a custom widget derived from a base type, such as a UISprite. Overwrite the OnFill function and you can fill it with a non-square geometry if you like.

1. "Behaved oddly" doesn't mean anything to me so I can't suggest anything.

Wisteso

  • Full Member
  • ***
  • Thank You
  • -Given: 21
  • -Receive: 3
  • Posts: 103
    • View Profile
Re: How is Unity Sprite support in NGUI lately?
« Reply #2 on: June 04, 2016, 04:19:28 PM »
@ArenMook

I'd love to be able to create a custom sprite that worked with convex meshes but to make it work with panel clipping and all would be a pretty big undertaking, no?

There's a huge incentive for this to exist, since convex packing can save a *huge* amount of texture memory and reduces fill rate dramatically. See http://www.spriteuv.com/comparisontexturepacker/ for an example of rectangle vs concave packing.

I can *try* to create it, but would simply overwriting OnFill be enough for it to work with the fancy features like panel hard/soft clipping?

---

Regarding the weird behavior, it seems to actually be gone in 3.8 - it must have been a symptom of an earlier version.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How is Unity Sprite support in NGUI lately?
« Reply #3 on: June 06, 2016, 10:01:15 PM »
Feeding your own geometry via OnFill is all you need. Clipping is done by NGUI as long as you use one of NGUI's shaders, such as "Unlit - Transparent Colored".