Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: TokyoDan on July 30, 2013, 12:32:05 AM

Title: Switching between SD,HD, & SHD works except for sliced sprites.
Post by: TokyoDan on July 30, 2013, 12:32:05 AM
I got NGUI setup to switch between SD,HD, & SHD atlases and fonts. Almost everything is working perfectly. Labels and buttons use the appropriate atlas and are the correct size corresponding to the device I run it on. But sliced sprites are not working. I setup one sprite in each of the SD,HD,SHD atlases as a sliced sprite. I create my UI using the SD atlas. But the sliced sprite is OK only when running on the device that pulls in the SD atlas. When a HD or SHD atlas is pulled in the sliced sprite looks like it is just a stretched, unsliced version of the sprite in the SD atlas although I can see from Debug.Log and actually stepping through the code that the proper atlas is being used.

This also happens in the editor. If I run the project with the Game Window set to NOT maximize on play the SD atlas is used and the sprite is properly sliced. But if I run the project with the Game Window set to maximize on play the HD atlas IS USED BUT the sprite is NOT properly sliced. (All the labels and buttons are properly scaled and displayed in each case.)

While labels and buttons are created via the Widget Tool, Sliced Sprites are created via the NGUI->Create a Sprite menu. So something weird is taking place. And when I create a sliced sprite I make sure that it is using my reference atlas and not the actual SD, HD, SHD atlases.

What am I doing wrong or what else needs to be done?

Title: Re: Switching between SD,HD, & SHD works except for sliced sprites.
Post by: Nicki on July 30, 2013, 08:12:10 AM
Have you set proper borders in the HD atlas on the sprites you use as Sliced? My guess is: no. :)
Title: Re: Switching between SD,HD, & SHD works except for sliced sprites.
Post by: TokyoDan on July 30, 2013, 04:10:18 PM
Have you set proper borders in the HD atlas on the sprites you use as Sliced? My guess is: no. :)

Of course I did. That was the first thing I did...in all three atlases. I layed out my UI with the reference atlases and forgot to mention that the SD version of the sliced sprite works as it should but the sliced sprite doesn't work when the HD and SHD atlases are swapped in.
Title: Re: Switching between SD,HD, & SHD works except for sliced sprites.
Post by: ArenMook on July 30, 2013, 04:35:23 PM
Why not? HD and SHD atlas should have 2x and 4x the border size of the SD atlas.
Title: Re: Switching between SD,HD, & SHD works except for sliced sprites.
Post by: TokyoDan on July 30, 2013, 06:14:55 PM
Here's what they look like. Notice that everything is scaled perfectly except for the button background (sliced sprite) in the SHD version.

https://www.dropbox.com/s/8lho11v3ljqcf2m/SD.PNG

https://www.dropbox.com/s/on3c5njc2dsu8a9/SHD.PNG
Title: Re: Switching between SD,HD, & SHD works except for sliced sprites.
Post by: TokyoDan on July 30, 2013, 06:29:32 PM
ArenMook, I fixed it! I had the darn atlas Pixel Sizes backwards. 1, 2, and 4, instead of 1, 0.5, & 0.25. That was the one thing I forgot to mess with to fix my problem and it just occurred to me this early morning in Tokyo. But if all of the buttons and fonts had been wrongly sized that would have been the first thing I would have looked at.

Thanks and sorry for the trouble.

BTW. All your stuff is great, and your tutorials too! I bought NGUI, TNET, and about to buy the UI Starter Kit: Starlink.
Title: Re: Switching between SD,HD, & SHD works except for sliced sprites.
Post by: ArenMook on July 30, 2013, 06:59:36 PM
:)