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 - ryan

Pages: 1 2 3 [4] 5 6
46
I don't know if this is bad practice, but I usually end up setting my UITexture's .material to a copy of the original, then any time I need to change the texture, I set .material.mainTexture instead of .mainTexture.  This may just be a holdover from earlier versions of NGUI where the UITextures needed explicit materials to be set.  A lot of the places where I use UITexture, I'm instantiating a prefab multiple times, and not copying the material meant updating one UITexture affected all of them.

Anyway, for Nicki's original problem, just wondering if setting friendPicture.material.mainTexture would be an easy solution.

47
NGUI 3 Support / Re: Password fields don't respect line width
« on: November 11, 2012, 11:47:55 PM »
I think there are two separate bugs here.  One with UIInput when the user is entering text, but another with UILabel that occurs even when inputs are not involved (the last example that I mentioned in my previous post).  That one's not just a matter of using the width of the original string instead of the width of the stars.  I can create a label with a string that far exceeds the line width, but as soon as I click the password box, it displays a star for every single character.

And I didn't forget to limit the number of characters on the UIInput.  My understanding was that the number of characters the user could enter was completely independent of how many should be displayed.  I hope I didn't misunderstand the intent of that property, because we're using that functionality elsewhere, and it works great with non-password fields.  :)

48
NGUI 3 Support / Re: Password fields don't respect line width
« on: November 09, 2012, 10:35:52 PM »
I don't see anything obviously wrong, and I did try creating a new input.  I've got some simple repro steps:

Import NGUI into a fresh project and open scene "Tutorial 9 - Input".
Select UI Root (2D)/Camera/Anchor/Panel/Input/UISlicedSprite and check the "Is Password" box on the UIInput component.
Press Play, click in the "You can type here" input, and hold down the period key until the password field overflows.

With this specific case, the stars will flow out the right side of the box for a little while, but eventually it snaps the carat to the right side of the box and the stars overflow the left end of the box.  At this point it does seem to be limiting the number of characters it's showing, but there are still too many.  When I hit return to finish the input, it looks like it shows all characters without limiting the length at all.

Another case in this same scene: select the UILabel with the big, multi-paragraph chunk of text.  Remove the first newline so that first line of text gets wrapped.  Check the password box on the label.  When I do this I see it limit the label to one line, but it still exceeds the line width.

49
NGUI 3 Support / Password fields don't respect line width
« on: November 09, 2012, 05:12:43 PM »
I'm seeing odd behavior using a password UIInput with a UILabel that has a line width set.  While entering text into the field, it seems to try to respect the line width, but it does so inconsistently.  The number of stars will increase or decrease as I enter characters, and sometimes the input carat will disappear and later reappear as I'm typing.  When the input loses focus, the label just shows the full number of stars, ignoring the line width completely.

This is with 2.2.3 on unity 3.5.6.

50
NGUI 3 Support / UICamera bug with bundled UIs
« on: November 01, 2012, 08:16:25 PM »
We're using asset bundles with some of our UI, and we discovered that apparently OnDestroy doesn't get called on objects destroyed as a result of a bundle being unloaded.  (At least this is what one of our other engineers tells me.)  That means if you unload a bundle that contained a UICamera, the static list of cameras isn't being properly cleaned up.  Patch below (against a slightly out of date version of NGUI) :

  1. Index: UICamera.cs
  2. ===================================================================
  3. --- UICamera.cs (revision 9034)
  4. +++ UICamera.cs (working copy)
  5. @@ -371,6 +371,8 @@
  6.  
  7.         static int CompareFunc (UICamera a, UICamera b)
  8.         {
  9. +               if (a == null) return b == null ? 0 : 1;
  10. +               if (b == null) return -1;
  11.                 if (a.cachedCamera.depth < b.cachedCamera.depth) return 1;
  12.                 if (a.cachedCamera.depth > b.cachedCamera.depth) return -1;
  13.                 return 0;
  14. @@ -387,7 +389,7 @@
  15.                         UICamera cam = mList[i];
  16.                        
  17.                         // Skip inactive scripts
  18. -                       if (!cam.enabled || !cam.gameObject.active) continue;
  19. +                       if (cam == null || !cam.enabled || !cam.gameObject.active) continue;
  20.  
  21.                         // Convert to view space
  22.                         currentCamera = cam.cachedCamera;
  23. @@ -418,6 +420,7 @@
  24.                 for (int i = 0; i < mList.Count; ++i)
  25.                 {
  26.                         UICamera cam = mList[i];
  27. +                       if (cam == null) continue;
  28.                         Camera uc = cam.cachedCamera;
  29.                         if ((uc != null) && (uc.cullingMask & layerMask) != 0) return cam;
  30.                 }
  31.  


51
NGUI 3 Support / Re: UIEventListener is missing OnKey
« on: September 26, 2012, 05:32:43 PM »
Thanks!  Somewhat related, I'm wondering if UICamera's genericEventHandler or fallThrough should receive OnKey events.  Seems like those would be a handy way to select a text input when the user hits tab while nothing else is selected.  Unless I'm missing a better approach?

52
NGUI 3 Support / UIEventListener is missing OnKey
« on: September 25, 2012, 04:49:26 PM »
I've added it locally.  Could this be integrated in a future release?

  1.         public delegate void KeyCodeDelegate (GameObject go, KeyCode key);
  2.         public KeyCodeDelegate onKey;
  3.         void OnKey (KeyCode key)                { if (onKey != null) onKey(gameObject, key); }
  4.  

53
NGUI 3 Support / Re: Particle systems and UI scale
« on: September 22, 2012, 10:47:34 AM »
We've had some stability issues with shuriken and iOS, but maybe they've been fixed since then.  Might be worth looking into.

54
NGUI 3 Support / Particle systems and UI scale
« on: September 21, 2012, 07:50:49 PM »
I'm trying to add a little flashiness to my UI with some particle systems, and I'm running into a problem.  I've got a particle system set up that I instantiate as a child of some UI widget, it's in the same layer as the UI and drawn using the same camera, everything looks great.  Switching from an iPad2 to an iPad3, however, gives me particle effects that are a quarter of the size.  On the retina display, the root of my UI hierarchy is being scaled up to twice the height and width to fill the extra pixels, but that scale doesn't affect the particle systems.  Has anybody had any luck dealing with this issue?  The best solution I can think of is to create separate versions of the effects to use on retina displays.

56
NGUI 3 Support / Re: Event for Show & Hide Keyboard
« on: September 14, 2012, 10:50:33 AM »
iOS keyboard has a button to close the keyboard that is not triggering a submit in NGUI.  Maybe it's just on iPad, but here's an example, bottom right key:

http://www.maclife.com/files/u12635/reminders_1.png

57
NGUI 3 Support / Re: UIDraggablePanel > Can have panel w/in panel?
« on: September 13, 2012, 03:17:41 PM »
Using multiple atlases doesn't necessarily mean you need multiple panels.  Although if I understand you correctly, you have elements from Atlas A both behind and in front of elements from Atlas B.  In the one case that I've had to do this within a clipped panel, I ended up creating a new atlas duplicating the few elements that needed to be displayed on top.  It requires a little extra texture space and an extra draw call (you've got the extra draw call already with the second panel), but it respects the panel's clipping.

You could probably share the same texture by just making a copy of the Atlas prefab, and possibly a copy of the material, but pointing at the same texture.  Just be careful if you need to change any sprites in one atlas, since it'll mess with the texture but not update the duplicated atlas prefab.

58
NGUI 3 Support / Re: Changing colors of individual chars within a string
« on: September 06, 2012, 01:55:00 PM »
[ffffff]Hello[-] [ff0000]World[-]

Assuming encoding is enabled for your label (there's a checkbox in the inspector), you can put a hexadecimal RGB value within square brackets to change the color of a string within the label.  A dash within square brackets clears the color back to the default for the label.

59
NGUI 3 Support / Re: UISprite, invert X, sprite not visible
« on: September 06, 2012, 01:51:26 PM »
I use negative scaling in a bunch of places to mirror sprites, so it's definitely possible.

60
NGUI 3 Support / Re: Feature Suggestions
« on: August 29, 2012, 04:52:19 PM »
A public function on UICenterOnChild to ask it to center on a particular object would also be handy.

Pages: 1 2 3 [4] 5 6