Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Tom G on September 18, 2012, 03:20:42 PM

Title: Help! Can't change sprite dimensions or borders in v2.2.0 (works in free 2.0.7)
Post by: Tom G on September 18, 2012, 03:20:42 PM
Hi,

Today I purchased NGUI v2.2.0 after being impressed with the free trial previously. Unfortunately, as soon as I started using the new version I found myself unable to do something pretty fundamental: change the Dimensions and Borders on a Sprite, in the UIAtlas inspector. In the old version, I just type a number into the green or blue boxes and it's done.  In the new version, the boxes always reset their values, no matter what I do.

I have tried restarting Unity. I have tried creating new Scenes.  I have even re-downloaded the whole of NGUI into a brand new Unity project, and it still won't work.  As soon as I downgrade to 2.0.7 (free), it works again.

I went in the UIAtlasInspector code to trace out some values, and it seems that for every one pass of the OnInspectorGUI which attempts to modify the green and blue values (Rect outer and Rect inner) there are then four or more passes triggered which all reset these Rects to their 'locked' values.  It's like it is always failing validation, and then being repeatedly pummelled back into its old values.

Please help -- I thought long and hard about this purchase and now I am very definitely in negative value for money!!  :-[

Thanks,

Tom
Title: Re: Help! Can't change sprite dimensions or borders in v2.2.0 (works in free 2.0.7)
Post by: PhilipC on September 18, 2012, 04:28:31 PM
Hi Tom,

We do know about this issue and Mike has already posted a fix for it here http://www.tasharen.com/forum/index.php?topic=1670.0. I'm sure that as soon as Mike is back he will release a new version with the fix.

Sorry for your frustration.
Title: Re: Help! Can't change sprite dimensions or borders in v2.2.0 (works in free 2.0.7)
Post by: Tom G on September 18, 2012, 06:06:43 PM
Thanks Phil,

The fix appears to work to some extent, in that it now allows me to change Borders (and so I can create a Sliced Sprite from an image) but I'm still seeing funky behaviour with the Dimension fields (the green ones) which won't budge, meaning I can't create multiple regular Sprites from one Atlas.  I'm completely new to NGUI, but I'm pretty sure that this should be possible!

I appreciate you're probably working hard to fix this, but I thought I'd let you know in case this was in fact a separate issue.

Cheers  ;)
Title: Re: Help! Can't change sprite dimensions or borders in v2.2.0 (works in free 2.0.7)
Post by: Tom G on September 18, 2012, 06:27:06 PM
OK - the temporary fix I'm using involved adding "mSprite.outer = outer;" after line 283 of the modified version of UIAtlasInspector.cs.
Title: Re: Help! Can't change sprite dimensions or borders in v2.2.0 (works in free 2.0.7)
Post by: ArenMook on September 19, 2012, 06:18:36 AM
Here is the updated inspector script that will live-update the changes properly.

I will update the Asset Store / direct download versions when I get home (tomorrow). Still at Unity HQ for the time being...
Title: Re: Help! Can't change sprite dimensions or borders in v2.2.0 (works in free 2.0.7)
Post by: Tom G on September 19, 2012, 07:10:50 AM
Amazing.  Thx.  Have fun at Unity!
Title: Re: Help! Can't change sprite dimensions or borders in v2.2.0 (works in free 2.0.7)
Post by: Martin Schultz on September 19, 2012, 07:42:57 AM
I tried the hotfix, but changing the border doesn't work. Not live updating nor having any effect here.
Title: Re: Help! Can't change sprite dimensions or borders in v2.2.0 (works in free 2.0.7)
Post by: ArenMook on September 19, 2012, 08:16:36 AM
Are you sure you placed it in the right spot?
Title: Re: Help! Can't change sprite dimensions or borders in v2.2.0 (works in free 2.0.7)
Post by: Martin Schultz on September 19, 2012, 08:23:05 AM
I take it  back, for some reason the old file stayed in ngui/scripts/editor. It works proper. Sorry for the confusion.
Title: Re: Help! Can't change sprite dimensions or borders in v2.2.0 (works in free 2.0.7)
Post by: athos on October 03, 2012, 12:27:20 AM
Using v2.2.1 downloaded from the asset store. Atlas padding doesn't work. Looks like this code is incorrect.

  1. mSprite.paddingLeft     = a.x / mSprite.outer.width;
  2. mSprite.paddingTop      = a.y / mSprite.outer.width;
  3. mSprite.paddingRight    = b.x / mSprite.outer.height;
  4. mSprite.paddingBottom   = b.y / mSprite.outer.height;
  5.  

Should be:
  1. mSprite.paddingLeft     = a.x / mSprite.outer.width;
  2. mSprite.paddingTop      = a.y / mSprite.outer.height;
  3. mSprite.paddingRight    = b.x / mSprite.outer.width;
  4. mSprite.paddingBottom   = b.y / mSprite.outer.height;
  5.  
Title: Re: Help! Can't change sprite dimensions or borders in v2.2.0 (works in free 2.0.7)
Post by: ArenMook on October 03, 2012, 01:04:49 AM
Hmm... wonder what happened there. I'll fix it, thanks.
Title: Re: Help! Can't change sprite dimensions or borders in v2.2.0 (works in free 2.0.7)
Post by: TokyoDan on September 17, 2013, 12:08:52 AM
This problem is back I can select the "Sliced" drop-down menu item from Sprit Type in the Inspector but the handles that allow you to adjust the edge margins do not appear.

This problem showed up in last version of NGUI Pro before that last update. And I just updated today to the latest version in the Asset store but it doesn't fix the problem. And I on Unity 4.2.1 which I updated to a few weeks ago.

I think Unity 4.2.1 may have broke NGUI sliced sprites because the last time i made sliced sprites they were OK and I was on Unity 4.1.x.
----------------------
Please disregard the above. I was doing it wrong. If anyone has the same problem here is the way to do it right:

http://www.tasharen.com/forum/index.php?topic=5669.msg26900#msg26900
Title: Re: Help! Can't change sprite dimensions or borders in v2.2.0 (works in free 2.0.7)
Post by: ArenMook on September 17, 2013, 02:19:52 PM
Handles only show up when you have them enabled via the NGUI menu, and when you're using the move tool (W).

NGUI 3.0 has been tested on Unity 3.5.7, 4.2.1, 4.3, and 4.X :)