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.

Topics - Gregzo

Pages: [1] 2
NGUI 3 Support / NGUI Infinite Pickers going free
« on: June 19, 2014, 03:13:47 PM »
Hi to all,

NGUI Infinite Pickers!/content/10024 is going free. I simply cannot find time anymore to support the project at the quality standard I would like to.

Please contact me if you are interested in taking over. I am not trying to sell it, but to transfer ownership to someone who is willing to keep the project going.

The asset is well ranked and has a 5 star average.



NGUI 3 Support / SpringPanel.onFinished sometimes very late
« on: August 02, 2013, 02:20:08 AM »

I'm having a rare issue where SpringPanel's onFinished delegate does not fire immediately when UICenterOnChild has finished centering, sometimes by as much as 10 seconds.
It doesn't happen often, I have to test for some times as much as 10 minutes for the bug to show up, but it's very much there.

Then again, it might be me : I'm using a modified version of UICenterOnChild.

Any help appreciated!

UICenterOnChildManual.cs :

  1. public class UICenterOnChildManual : MonoBehaviour
  2. {
  3.         UIDraggablePanel mDrag;
  4.         GameObject mCenteredObject;
  6.         public SpringPanel.OnFinished onFinished;
  8.         void Awake ()
  9.         {
  10.                 mDrag = gameObject.GetComponent ( typeof ( UIDraggablePanel ) ) as UIDraggablePanel;
  11.                 //Test
  12.                 onFinished += Test; // for debugging purposes
  13.         }
  15.         /// <summary>
  16.         /// Recenter the draggable panel on targetTrans.
  17.         /// </summary>
  19.         public void CenterOnChild( Transform targetTrans )
  20.         {
  21.                 Debug.Log ("CenterOnChild called at "+Time.time);
  23.                 if (mDrag.panel == null) return;
  24.                 // Calculate the panel's center in world coordinates
  25.                 Vector4 clip = mDrag.panel.clipRange;
  26.                 Transform dt = mDrag.panel.cachedTransform;
  27.                 Vector3 center = dt.localPosition;
  28.                 center.x += clip.x;
  29.                 center.y += clip.y;
  30.                 center = dt.parent.TransformPoint(center);
  32.                 // Offset this value by the momentum
  33.                 mDrag.currentMomentum =;
  35.                 // Figure out the difference between the chosen child and the panel's center in local coordinates
  36.                 Vector3 cp = dt.InverseTransformPoint(targetTrans.position);
  37.                 Vector3 cc = dt.InverseTransformPoint(center);
  38.                 Vector3 offset = cp - cc;
  40.                 // Offset shouldn't occur if blocked by a zeroed-out scale
  41.                 if (mDrag.scale.x == 0f) offset.x = 0f;
  42.                 if (mDrag.scale.y == 0f) offset.y = 0f;
  43.                 if (mDrag.scale.z == 0f) offset.z = 0f;
  45.                 // Spring the panel to this calculated position
  46.                 SpringPanel.Begin(mDrag.gameObject, dt.localPosition - offset, 8f).onFinished = onFinished;
  47.         }
  49.         void Test ()
  50.         {
  51.                 Debug.Log ("SpringPanel finished at "+Time.time);
  52.         }
  53. }

NGUI 3 Support / NGUI Infinite Pickers - Now on the Asset Store
« on: July 25, 2013, 04:28:45 PM »
Hi to all,

My pickers framework for NGUI has grown quite a bit lately, and has become completely WYSIWYG :

-Infinitely customizable
-Adjust widgets right in the picker inspector, no need to handle them individually
-One click to change from horizontal to vertical
-See only 3 elements at once, or 53, you decide
-NGUI inspired workflow means you'll feel at home straight away
-Mobile friendly ( recycles the minimum required amount of GameObjects and UIWidgets )
-Many prefabs included
-Open to requests : see review in the Asset Store

Details, video tutorials, asset store link and support are here :

Happy picking,



NGUI free doesn't come with UICenterOnChild, so I've made my own version, UICenterOnChildManual, which centers on a specific Transform as opposed to finding the center-most transform itself.
It's very much a stripped down version of the original, adapted for compatibility and use with my pickers.
Is it OK to include it in my asset store package?
Here it is :

  1. using UnityEngine;
  3.         /// <summary>
  4.         /// Manual version of NGUI's UICenterOnChild -stripped down and adapted for compatibility with NGUI free
  5.         /// </summary>
  6. public class UICenterOnChildManual : MonoBehaviour
  7. {
  8.         UIDraggablePanel mDrag;
  9.         GameObject mCenteredObject;
  10.         UIPanel mDragPanel;
  12.         /// <summary>
  13.         /// Recenter the draggable list on targetTrans.
  14.         /// </summary>
  16.         public void CenterOnChild( Transform targetTrans )
  17.         {
  18.                 if (mDrag == null)
  19.                 {
  20.                         mDrag = NGUITools.FindInParents<UIDraggablePanel>(gameObject);
  22.                         mDragPanel = gameObject.GetComponent ( typeof ( UIPanel ) ) as UIPanel;
  24.                         if (mDrag == null)
  25.                         {
  26.                                 Debug.LogWarning(GetType() + " requires " + typeof(UIDraggablePanel) + " on a parent object in order to work", this);
  27.                                 enabled = false;
  28.                                 return;
  29.                         }
  30.                 }
  31.                 if (mDragPanel == null) return;
  33.                 // Calculate the panel's center in world coordinates
  34.                 Vector4 clip = mDragPanel.clipRange;
  35.                 Transform dt = mDragPanel.cachedTransform;
  36.                 Vector3 center = dt.localPosition;
  37.                 center.x += clip.x;
  38.                 center.y += clip.y;
  39.                 center = dt.parent.TransformPoint(center);
  41.                 // Offset this value by the momentum
  42.                 mDrag.currentMomentum =;
  44.                 // Figure out the difference between the chosen child and the panel's center in local coordinates
  45.                 Vector3 cp = dt.InverseTransformPoint(targetTrans.position);
  46.                 Vector3 cc = dt.InverseTransformPoint(center);
  47.                 Vector3 offset = cp - cc;
  49.                 // Offset shouldn't occur if blocked by a zeroed-out scale
  50.                 if (mDrag.scale.x == 0f) offset.x = 0f;
  51.                 if (mDrag.scale.y == 0f) offset.y = 0f;
  52.                 if (mDrag.scale.z == 0f) offset.z = 0f;
  54.                 // Spring the panel to this calculated position
  55.                 SpringPanel.Begin(mDrag.gameObject, dt.localPosition - offset, 8f);
  56.         }
  57. }



NGUI 3 Support / NGUI Pickers - WebPlayer
« on: July 03, 2013, 04:51:39 AM »
Hi to all,

I finally had enough free time to give my pickers project a bit of work.

-Horizontal and vertical
-Labels, sprites, compound objects
-Add / remove elements dynamically
-Receive selection callbacks as index or content ( label text, spritename )
-Recycles 5 objects for best performance ( no instantiate )

Here's a web player demo

I plan to release it on the Asset Store soon, comments and suggestions are welcome!

Known issue : doesn't handle well very fast dragging. The workaround I can think of involves modifying UIDragPanelContents, which really isn't suitable for a publicly available asset. Any ideas to clamp drag values without changing NGUI classes ? [EDIT] : Issue solved, will post a new build soon. Pickers can now handle any speed.




Labels don't display one of my fonts properly anymore, all I get is a jumble of shapes seemingly taken at random from the atlas.
I've checked the atlas, the font is still there. Tried rebooting, nope.

Only one of the fonts is screwed up. Weird thing : it still displays fine on iOS.
Last thing I did before it happened was to import FingerGestures.

Any clues? I could re-import the font but am scared it'll mess up all my labels.

Thanks in advance for your help,


Edit : Solved. When selecting the font prefab, the Import Font field always displays "None ( Text Asset ) ". Dragging the font's text asset there solved it. Still no clue as to what happened, though...


It seems that setting UIDragObject's target at runtime doesn't work properly. Strangely, if it is never allowed to be null, and never disabled/enabled, everything's fine.
In the following example, I'm trying to start dragging a transform after a long press on another. The hacky workaround I'm using involves setting up a decoy transform, hmm...
Surely I'm missing something? Setting the target in OnPress(true) works fine too, problems arise when press and setting the target are seperate.

Many thanks for your help,


  1. public Transform targetTransform; // not the receiving collider's transform
  2. public Transform decoyTransform; // assign an empty go in the inspector
  4. UIDragObject uiDragObject;
  6. void Awake ()
  7. {
  8.       uiDragObject = gameObject.AddComponent ( typeof ( UIDragObject ) ) as UIDragObject;
  9.       // = decoyTransform; //Uncomment this line, and it works fine.
  10. }
  12. void OnLongPress () // custom long press
  13. {
  14. = targetTransform;
  15. }

NGUI 3 Support / Pickers - anyone interested?
« on: January 29, 2013, 03:44:34 PM »
Hi to all,

I've just made a few pickers for NGUI after seeing that no usable NGUI picker existed in the Asset Store. If there's enough interest, I'd polish and sell them for a very decent price.
They're modelled after iOS pickers - swipe to pick, next and previous element visible.

What I have :
1)Text picker : pass it a string[], swipe to pick. Access textPicker.selectedIndex to access the user selected index in the array you passed, or textPicker.selectedString to directly access the string.
2)Date picker - pass it a System.DateTime, swipe to pick. Example : datePicker.Init(System.DateTime.Now) will set the picker to the current date. Access datePicker.selectedDate to get the user selected date as a DateTime object.
3)Number picker : pass it a min number, a max number and a step value. Example : picker with even numbers from 26 to 88 : numberPicker.Init(26,88,2);

For the moment, the pickers use 5 UILabels which are recycled for best performance (no Instantiate). 3 of the 5 labels are always visible, and the picker is "infinite" (loops).

Features I could add, do give feedback if you're interested!
A)Choose how many items you want visible at once.
B)Sprite picker (pass it an array of UISprite or UIScaledSprite)
C)Sprite+String picker (useful if you need an icon and some text in the picker)
D)Horizontal pickers (rarely used afaik)



NGUI 3 Support / OnTouchEnter - suggestion
« on: January 29, 2013, 03:24:15 PM »
Hi to all,

I've recently modified UICamera.cs so that objects on specified layers receive OnTouchEnter(bool enter) events. Very handy when one needs to be able to slide from one object to an other (slide on the keys of a keyboard, for example).
Is there a chance of seeing that feature in a future update?

I've seen stickyPress has made its entrance, but don't really understand what it does. Forum search hasn't helped much... If it achieves what I'm proposing, apoligies.



NGUI 3 Support / Fed up with res problems on apple devices
« on: September 01, 2012, 12:06:34 PM »
Just kidding!

NGUI is amazing, I just realized that without doing anything, UI's get rescaled according to Screen.height and Screen.width (ratio maintained), even if UIRoot.automatic is false and manual height is set to 1536 (iPad3).

Very convenient to test out things before making a seperate atlas.

Congrats to Aren. NGUI is by far the best buy I've made on the asset store.


NGUI 3 Support / [SOLVED] Problem with colliders' depth...
« on: August 29, 2012, 02:25:58 AM »

Here's my problem : I need to sort the depth of overlapping colliders in the same panel. Trouble is, the colliders aren't attached to sprites, so no way to change the depth property. Tried all sorts of Z-eding around, nope.

Anyone can help?



P.S. : Because of nesting, I can't add the collider to the sprite itself (structure : parentObjWithCollider->childrenSprites)



So, I'm customizing popupLists (menu in this case, as the label isn't updated).

The original label is "Options". The bottom image shows a popped list above, and is what I'm aiming for. The top image shows the same, but with a downwards popping list: not quite right... My background sprite is exactly the mirror image of the working one.

It just seems the instantiated drop-down list is not positioned at the same distance in the above and below cases.

Also, even if my label's pivot is Center, the labels in the instantiated Drop-Down list all have left for pivot.

It would be great to be able to control : a> y distance of drop down list to object - b> pivot of drop-down list's labels



NGUI 3 Support / [Solved]Selecting UIInput widget by code?
« on: August 15, 2012, 04:02:32 AM »

I'd like to automaticaly trigger the appearance of the onscreen keyboard (iOS) for a UIInput widget. Tried to send OnClick() and OnSelect(true) messages to it, nope...

Anyone can help?




I'm not sure if it's Unity or NGUI, but when the default iOS keyboard appears (UIInput click), there's a severe performance drop, causing audio to stutter (only 2 sources playing).

Any clues?



NGUI 3 Support / UISprite - size changes on spriteName swap...
« on: July 25, 2012, 02:59:56 AM »

Must be something silly I'm not seeing. I'm changing the sprite of a UISprite at runtime, swapping between two versions of the same sprite (same size and import settings, same atlas). But one appears about 10% smaller than the other... Transform doesn't change, just the appearance.

Any clues?

Many thanks,


Pages: [1] 2