Author Topic: NGUI 3.0  (Read 36187 times)

Vonchor

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: NGUI 3.0
« Reply #15 on: September 19, 2013, 03:54:42 PM »
Thanks!   :)

pahe

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 1
  • Posts: 37
    • View Profile
Re: NGUI 3.0
« Reply #16 on: September 19, 2013, 04:05:18 PM »
Will it be possible to set different atlases to one layer and z-sort the layer then? E.g. I have sprite A on atlas A and sprite B and C on atlas B.
Now I want to have sprite A in front of B and behind C. This couldn't be achieved at the moment, right?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI 3.0
« Reply #17 on: September 19, 2013, 04:06:37 PM »
3.0 supports it just fine, and will create extra draw calls as needed. Just watch the video for it.

Also, Z is no longer used. Just depth.

NaxIonz

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 70
    • View Profile
Re: NGUI 3.0
« Reply #18 on: September 19, 2013, 05:05:13 PM »
3.0 supports it just fine, and will create extra draw calls as needed. Just watch the video for it.

Also, Z is no longer used. Just depth.

And it appears this is shared across panels?

It used to be that you could ensure that everything one a panel would be infront just by adjusting it's Z. And now, that's not the case, which makes it much more cumbersome to make sure a popup dialog or something like that is 100% infront of other UI.

And if you have a scenario where this could be 3-4 items deep, that's kinda a pain that they all share the same depth pool.

pahe

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 1
  • Posts: 37
    • View Profile
Re: NGUI 3.0
« Reply #19 on: September 19, 2013, 05:48:31 PM »
Yes, is it shared across panels? To be more precise with the example:

I have a background and a foreground texture on one atlas and I have a character texture on another atlas. I want this character in front of the background, but behind the foreground.
This was not possible to achieve with 2.6.x afaik, so you had to separate the background and the foreground to own atlases (making it three atlases).

I'm not sure if this could also be achieved when using more UIPanels for that instead of atlases, not tried that one. But I would like to have several atlases and UIPanels and still want to share the depth sorting across these panels. So, is this possible? In the video (I saw it now twice, as I thought I had missed something) you only use one atlas, so it's clear that this will work.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI 3.0
« Reply #20 on: September 19, 2013, 11:26:16 PM »
Yes, it's shared across all panels, and no, it's not cumbersome. Simply use high depth values for your popup, and its content will always show on top. You can also just select a window and hit CTRL+= a few times to bring it forward (doing so adjusts the depth of all the widgets underneath by +1 each time).

Furthermore, you get a list of all the widgets managed by the panel when you select them, including the draw calls those widgets end up in -- handy for debugging (new in rc2).

pretender

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 155
    • View Profile
Re: NGUI 3.0
« Reply #21 on: September 20, 2013, 12:02:38 AM »
Can NGUI 3.0 be effectively used with older Unity 3.5.7? I have not upgrade yet, since I have 3.5.7 Pro
Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI 3.0
« Reply #22 on: September 20, 2013, 12:03:13 AM »
Yes, however CTRL+- and CTRL+= keys don't seem to work on 3.5.7.

TokyoDan

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 53
    • View Profile
Re: NGUI 3.0
« Reply #23 on: September 20, 2013, 12:19:26 AM »
So where can we get this. It's not in the Asset Store?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI 3.0
« Reply #24 on: September 20, 2013, 12:27:36 AM »
It's only available to Professional users for now. I am still working on it.

NaxIonz

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 70
    • View Profile
Re: NGUI 3.0
« Reply #25 on: September 20, 2013, 09:56:26 AM »
Yes, however CTRL+- and CTRL+= keys don't seem to work on 3.5.7.

I have 3.5.7:
Cmd+- and Cmd= seem to work on the selected widget, but does not propagate down to all the children under this game object.

So there does not appear to be any simple fix to this shared depth system :-\
It's going to take hours to twiddle all these values for 100's of widgets, and then test over and over to make sure I don't still have some sandwiching happening.

It would have been MUCH better if the new depth system was panel specific. Oh well.

NaxIonz

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 70
    • View Profile
Re: NGUI 3.0
« Reply #26 on: September 20, 2013, 10:38:27 AM »
I just made this little class and stuck it on the root of my various menus/popups:


  1. [ExecuteInEditMode]
  2. public class DepthAdjuster : MonoBehaviour
  3. {
  4.   public bool m_apply = false;
  5.   public int m_delta = 0;
  6.  
  7. #if UNITY_EDITOR
  8.   public void apply_delta(UIWidget[] widgets, int delta)
  9.   {
  10.     if (widgets != null) {
  11.       for (int i = 0; i < widgets.Length; i++) {
  12.         widgets[i].depth += delta;
  13.       }
  14.     }
  15.   }
  16.  
  17.   private void Update()
  18.   {
  19.     if (m_apply) {
  20.       m_apply = false;
  21.       apply_delta(gameObject.GetComponents<UIWidget>(), m_delta);
  22.       apply_delta(gameObject.GetComponentsInChildren<UIWidget>(), m_delta);
  23.       m_delta = 0;
  24.     }
  25.   }
  26. #endif
  27. }

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI 3.0
« Reply #27 on: September 20, 2013, 04:28:13 PM »
As of RC2, CTRL+= and CTRL+- adjust the entire hierarchy by a single depth value (+1 or -1).

ALT+SHIFT+= and ALT+SHIFT+- moves the selected object (and all of its children) to the very front or back.

P.S. And no, depths wouldn't be better remaining panel-specific. They were like that pre-2.7, and that was a nightmare with the Z vs depth.

nzen

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 30
    • View Profile
Re: NGUI 3.0
« Reply #28 on: September 21, 2013, 08:57:14 AM »
Handles are bugged. They're off by default, but selecting anything like a button makes them appear as gray, which blocks right-clicking to look around.

N3uRo

  • Guest
Re: NGUI 3.0
« Reply #29 on: September 21, 2013, 09:40:27 AM »
Hi Aren,

Glad you finally released 3.0 to all users.

I'm testing with the Examples scenes and I have some suggestions/wishes/questions:

1. UIWidgetContainer: What is the purpose of UIWidgetContainer besides graying and disabling handles? It only contains code in the inspector, the runtime class it's empty. I suppose we only are going to add it when we need to disable resize on scene view?

2. Event system: UIButton and some others like UISlider has the new event system that is really great and each has it's events "OnClick" or "OnValueChange". But why there is no generic event handler? Think UIButtonMessage/UIForwardEvents mixing into one "UIEventHandler" (or something like that) with that inspector look functionality. And also why UIButton has only "OnClick"?

3. Widget depth control shortcuts: In the US keyboard layout I suppose it works Ctrl+- and Ctrl+= for widget depth control but in Spanish layout the "=" key (triggered by shift+0) is with "0" so when I hit Ctrl+= it opens Unity version control Window that opens with Ctrl+0.

4. Tween control: The Tween system remains the same besides the inspector change. I always wanted a better control with "Pause", "Resume", etc... Now (correct if I'm wrong) it relies on the component state (enabled/disabled).

5. UIToggle and groups: Can you show in the inspector the groups in a way similar the the UIPanel widget dropdown? In a large project it can be really difficult to keep track of the group id without repeating it by mistake.

I was looking UIAnchor and the "Container" property that is a GameObject now and that's fine. Looking into the code I see that "CalculateRelativeWidgetBounds" now has an argument to include the inactive widget. Since which version is there? I had troubles with that in the past for not having this option.

Thanks Aren!