Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - psngui

Pages: [1]
1
NGUI 3 Support / Re: Sprite Atlas Broken on IOS (Fixed)
« on: October 01, 2014, 08:06:19 PM »
There is a default maxTextureSize value, and there is an override maxTextureSize value.

With the two values, we can update atlases in these steps:
1. Calculate the ratio of the override value against the default value. Typical values can be: 1/2, 1/4, 1/8, etc.
2. Iterate through all the atlases and do the following steps
   a) Iterate through all the sprites in the atlas
   b) For every sprite, find the relevant source image file, resize it (create new may be a good idea) with the ratio calculated
   c) After all the image files are generated, recreate the atlas with the new image files

To solve that binary/text-based problem, you just have to add a line in NGUI readme file or web page, something like this: If you are going to use Override settings on atlases, you have to enable xxxxxx, which is located at xxxxx. I'm sure you can come up with much better way of saying it.

There is a reason why Unity provide override settings for atlases: some projects, including ours, want to manage images in a way that they are suitable for high-end devices, with the capability to downscale to fit low-end devices, in a convenient way; or in other words, there is only one copy of all the images and they are in highest resolutions.

The mess-up of UI when using atlas' override settings is a bug (or an incomplete feature) of NGUI. I'd think as the author of NGUI, you'd care to perfect your product. (I think NGUI is great, by the way.) However, if you are too busy or reluctant to do it because maybe only a few people use this feature, it will be appreciated if you can validate my theory so that I can do it myself.

Thanks.

2
NGUI 3 Support / Re: Sprite Atlas Broken on IOS (Fixed)
« on: October 01, 2014, 02:20:34 AM »
Hi ArenMook,

I just did a file comparison on an atlas between before and after applying override settings of iOS and here are my findings:

1. One (and only file) is changed: the atlas (.png.meta) file.
2. textureFormat is changed from 5 to -3
3. textureSettings/aniso is changed from 4 to 1
4. nPOTScale is changed from 1 to 0
5. buildTargetSettings is changed from [] to the followings:
- buildTarget: iPhone
  maxTextureSize: 4096
  textureFormat: -3
  compressionQuality: 50

All I did was ticking the Override for iPhone then clicking Apply, in which case Max Size is 4096. If Max Size is changed to say 1024, then it will be 'maxTextureSize: 1024' in the .png.meta file.

I believe this information is sufficient for NGUI to update atlases accordingly.

I know that UnityEditor.Callbacks.PostProcessScene can be used to get notified just before a scene is built. According to the doc, BuildTarget and/or RuntimePlatform can be used to determine target platform (I'm not sure about this one). It seems that an automated process can be added to NGUI to generate iOS (or whatever platform with overridden settings) atlases using the override settings.

If that's not possible, at least a manual process (a button for example) can be added to fulfill the need.

Please let me know if any of these is possible.


3
NGUI 3 Support / Re: Sprite Atlas Broken on IOS (Fixed)
« on: September 29, 2014, 10:36:37 PM »
The problem with largest size is that our game runs out of memory on iOS. We have to downsize all the textures manually (without using the override settings), and manually refresh the atlas to make it work. We considered it as a temporary workaround and was looking for an official solution. Are you saying that there is nothing NGUI can do about it?

EDIT: There seems to be miscellaneous information in .meta file of atlases (.png), e.g., maxTextureSize. Maybe worth a look?

4
NGUI 3 Support / Re: Sprite Atlas Broken on IOS (Fixed)
« on: September 25, 2014, 07:56:26 PM »
Please check the attached image for what the override settings of atlases are. This is the main problem what this thread is talking about.

The main reason I asked about how to do it is because I'm not experienced in NGUI, and Unity. I wouldn't even understand what your solution (the editor window) means if I haven't luckily enough run into and learned about editor window two days ago. But anyway, thanks for the help.

5
NGUI 3 Support / Re: Sprite Atlas Broken on IOS (Fixed)
« on: September 24, 2014, 07:06:19 PM »
Could you give me some details on how to do it so that no NGUI code is modified? I'd like a button somewhere in Unity so that when it's clicked, the chosen atlas get fully refreshed/updated/regenerated.

Also could you let me know how I can deal with the override settings of atlases? Is that something I can do without modifying NGUI code? Batch downsizing all the images in the game is just a temporary workaround. Ultimately we'll need full sized images to work. It means the override settings need to be working.

Cheers,

6
NGUI 3 Support / Re: Why UISlider is not empty when 0?
« on: September 23, 2014, 07:20:41 PM »
We're experiencing the same problem. We use the same prefab. NGUI's version is 3.6.0.

There is a UIProgressBar class, which is the base class of UISlider. I'm wondering why the progress bar is made with UISlider rather than UIProgressBar.

7
NGUI 3 Support / Re: Sprite Atlas Broken on IOS (Fixed)
« on: September 22, 2014, 07:22:06 PM »
Hi ArenMook,

Thanks for the suggestion.

I wouldn't mind trying to fix the problem by myself. Your direction will be helpful. But the thing is that with my own modifications to NGUI there is long term impact on the project. If a new NGUI version is out with some feature we really need, we'll have to do the merge, which can be both time consuming and error pruning.

The request I made is not only an improvement of NGUI, but also a fix to known problems. Would you please consider implement it and include it in official NGUI builds?

Cheers,

8
NGUI 3 Support / Re: Sprite Atlas Broken on IOS (Fixed)
« on: September 17, 2014, 08:08:29 PM »
Hi ArenMook,

Thanks for taking time to view and answer my question.

Is it possible to add a 'manually update atlas' button in Atlas Maker, so that when it's clicked it updates everything in the atlas with the current import settings? I reckon it will solve the problem that NGUI can't automatically pick up the import settings changes done in Unity.

The button will be handy even if it's not for import settings. The way we got around with the problem was to down-size all the images. But to update the atlases, we have to hand-pick all images which is time consuming and error pruning. An "Update All" or "Update Atlas" or "Recreate Atlas" button will be very handy in this case.

Cheers,

9
NGUI 3 Support / Re: Sprite Atlas Broken on IOS (Fixed)
« on: September 12, 2014, 12:17:29 AM »
I know that this is an old thread. But we are experiencing the same problem.

It happens not only when making iOS builds with override checkbox ticked, but also when reloading the scene after reducing Max Size in the Default tab of atlases. Note that it only happens when the size is made small enough.

It seems to us that NGUI doesn't pick up such changes made to atlases. Or to be more specific, the UVs of sprites are not updated when such changes are made.

Could you please have a look at the problem, ArenMook?

Not sure if this is related, but here are our settings in the UIRoot:
Scaling Style: FixedSize
Manual Height: 2048
Shrink Portrait UI: Unticked
Adjust by DPI: Unticked

Cheers,

Pages: [1]