Ideally the border scale parameter would need to be specified on the atlas rather than on the sprite. It's also not the best solution... I'm thinking of having some sort of a parameter on the UIRoot that would address this instead, but I haven't quite figured out the best way just yet. I'm letting it sit at the back of my mind while I'm working on other things.

Can anyone advise me on how to stop sprites from automatically scaling when I press play?

I am trying to use NGUI for simple in-game sprites(as well as UI) rather than integrate a second additional 2d solution. I want the sprites to approximate real-world sizes rather than pixel sizes, so I'd like the size of the sprite in the game view to be consistent with how I set it up in the scene view.

I tried adding my sprite underneath a Panel (no UI Root or Camera) and setting all transform scales manually, but I when I press play it jumps up to "pixel perfect" size. I want it to stay the size I make it in the scene view.

Additionally, I read that moving the sprite widget itself causes an expensive mesh rebuild; is this also the case if I give the widget a parent gameobject and move that instead?

Moving the parent is not as expensive, but still much more expensive than moving a panel. Sprites shouldn't resize to pixel-perfect coordinates on Play, and as far as I can tell they don't. I use a stretched UISprite for a background in more than one example (for example, UISprite - Backdrop in Example 2). Hitting Play doesn't resize it. I don't think they ever did... what version of NGUI do you have?

I guess I must be doing it wrong - the Sprite was set to 128 scale in XY when NGUI created it, and if I change that it gets set back to 128 when I press play. Changing the parent gameobject works though, so I think I am not supposed to be scaling the sprite Widget directly?

I am looking to have hundreds of sprites (bullets, simple animated units) moving individually so I think a panel for each one is not ideal. At the moment my prototype is just using mesh quads and lots of drawcalls.

Is there anything I can do to that animation script to stop that behaviour?

Or do you think it is not worth me trying to use NGUI for this kind of thing performance-wise, since I am moving quite a lot of sprites around? All I am really trying to do is leverage the existing atlas and sprite tools so I don't have to do it all manually myself by mapping quads.

ex2D is only $15 at the moment, I could just get that for the in-game stuff; I just wanted to avoid another atlas/sprite system if possible and thought I'd try NGUI first since I already use it for UI.

Do you need the sprite to be animated like that? If you want something simple like changing a color or growing in size, tweens are a better way to go here. If you need something more complex, then you can use an image button. UISpriteAnimation is mainly for playing out animations of many sprites (for example sparkle effects over a button). You can still scale it by scaling the parent. Anything more complicated, such as skeletal animation for a character, and I suggest creating it in a modelling package.

It's pretty much exactly the same. You will use the Create UI tool to create your UI, making sure that the game's camera doesn't see the UI layer, and that the UI camera only sees the UI layer. You then have an option to create a UI right there, or create it in another scene and just save it as a prefab that will be bright into the main game.

I personally just use the former approach. My UI is generally created off to the side somewhere (or above the rest of the game, with the Y of 1000 or so). So when working there I just switch the camera to ortho, navigate to the UI, and modify what I need.

1.85:
- NEW: Added Example 12: Better Scroll View.
- NEW: Added a script that can be used to efficiently drag the contents of the panel: UIDragPanelContents.
- NEW: Added a function replacement for SetActiveRecursively (NGUITools.SetActive), since the former has rare odd issues.

1.84:
- FIX: Changed the way the font data is stored, resulting in potentially better loading performance on mobile devices.
- FIX: UIPanel.Start() should now find cameras faster.
- FIX: UIPanel will no longer use the clipping softness value unless soft clipping is actually used.
- FIX: The way click / drag was handled has been changed a bit. It should now be easier to click buttons on retina screens.
- FIX: Rebuilding an atlas was not updating fonts correctly.
- FIX: Couple of tweaks to UIAtlas and UIFont's replacement feature.

1.83:
- NEW: Added a simple script that can save the state of the checkbox (or a group of checkboxes) to player prefs.
- FIX: A variety of minor tweaks.

Instead of moving the widgets, it moves the panel (which is very efficient) and adjusts the clipping rect in the opposite direction, thus creating the effect of moving the contents, when in fact they lie still. Since the contents lie still, the buffers don't get rebuilt, which results in much better performance when scrolling through a long list on mobile devices.

Maybe it is just me but I am getting this when updating the package:
Assets/Editor/Editor/NGUIJson.cs(60,57): error CS1061: Type `UIAtlas' does not contain a definition for `spriteList' and no extension method `spriteList' of type `UIAtlas' could be found (are you missing a using directive or an assembly reference?)

Yes, this is very useful info. I am concerned because of the mobile performance. As of now I use the DragObject, but then I will switch to the Panel solution. Re-do it for camera use is too much work, but who knows, if I can get 10 fps more, I might consider...

Depends on what you want to do with it. If you want pixel-perfect results, keep UIRoot set to 'automatic'. If you want predictable results, turn off the automatic option and set the target resolution. The UI will scale as the resolution changes, staying the same size relative to the height of the screen. In the next version I'm also going to add something similar to a "dpi" setting to the UIRoot, as some guys (yuewah) need it for what they're trying to achieve.

I'm seeing the following problem with the uipopuplists that I create. The list items and the hilite for the items are working correctly, but the underlying slicedsprite for the background of the dropdown list seems to be off:

Not sure what could be causing it... The same slicedsprite is being used for everything. It's like the box starts halfway down the first item.

Basically I have a co-routine which goes through an array of game objects and resets the label text and colour in the child objects. It works perfectly with the exception of the alpha value. It seems it can only ever be 255 or 0 and nothing in between. It also works perfectly if I do something like color = Color.red; or even new Color(255, 40, 205, 255); or something similar.

1.86
- NEW: UIAtlas now has a "pixel size" property that affects MakePixelPerfect logic as well as sliced sprite's border size.
- FIX: UISprite will now always ensure it has a sprite to work with, if at all possible.
- FIX: UIDragPanelContents should now work correctly on mobile devices.

The sprites are referenced by names, so there is no need to change prefabs. Assuming you have them use the reference atlas, when this sprite is brought into the scene it will automatically pull from whatever atlas it's pointing to.

The sprites are referenced by names, so there is no need to change prefabs. Assuming you have them use the reference atlas, when this sprite is brought into the scene it will automatically pull from whatever atlas it's pointing to.

I understand that, yuewah... but nothing should be referencing your final HD / SD atlases. All widgets should be referencing the "main" atlas. This way when the main atlas's "reference" value gets changed, all widgets using it will update automatically, regardless of where they are. Only active scene objects need to know about this change because they need to be notified so they can re-draw themselves. Widgets that are not in the scene or are inactive don't need to be notified.

If you are having some issue with this, can you post some more info with what's going wrong and where?

Before that, I find another bug about the prefab. Based on the tutorial 2, I make the one of the UISprite to be prefab in Asset Folder, then call NGUITools.AddChild( panel, prefab ); In 1.86c, it raise the following exception, but 1.86 works without problem.

Unable to find an appropriate root to add the widget.
Please make sure that there is at least one game object above this widget!

Thx a lot. Another problem, When using NGUITools.AddChild( panel, prefab ), the new UISprite (Clone) local positon, scale and rotation is not the same as UISprite prefab. I think it is better to have a option to allow keep them the same or reset. What do you think ?

Hi ArenMook just downloaded ngui 1.86d2 !
I have a small problem when i add a button the collider seems to be translated on x to 59.5 and on y -15 and are slightliy oversized so i manually have to set it to x=0 and y=0 and the size correctly.
i tried changing the handle mode to pivot or center and add another button to test but that did not see to affect it... i also tried the global and local coordinates but i still see the same thing
When i manually add a collider then everything is ok
Could you please let me know of a quick fix so i dont have to manually add colliders to each button ?