Author Topic: NGUI 3.0  (Read 37246 times)

N3uRo

  • Guest
Re: NGUI 3.0
« Reply #45 on: September 23, 2013, 03:07:14 PM »
@broken: In 3.0 position.Z is not used at all. To bring something to front, use NGUITools.AdjustDepth. Check how I use it in NGUIMenu.

If you want to sort "Windows"? Suppose I have 3:

- W1
- W2
- W3

And I want to W2 be between 1 and 3. What should I do? It's not bring to the front.

In versions previous to 3.0 I simply change Z accordingly (and sometimes also add a Panel to "fix" the depth issues).

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI 3.0
« Reply #46 on: September 23, 2013, 04:00:12 PM »
Use AdjustDepth. Pass the game object for your window to it, and it will adjust the depths accordingly. For example -100 will push it back. +100 will bring it forward. I also have NGUIEditorTools.NormalizeDepths(); in the editor, and if there is a desire, I'll move it from the editor side to the runtime as well. AdjustDepth(1000) followed by NormalizeDepths will cleanly bring something forward.
  1.         static public void NormalizeDepths ()
  2.         {
  3.                 if (UIWidget.list.size > 0)
  4.                 {
  5.                         UIWidget.list.Sort(delegate(UIWidget w1, UIWidget w2) { return w1.depth.CompareTo(w2.depth); });
  6.  
  7.                         int start = 0;
  8.                         int current = UIWidget.list[0].depth;
  9.  
  10.                         for (int i = 0; i < UIWidget.list.size; ++i)
  11.                         {
  12.                                 UIWidget w = UIWidget.list[i];
  13.  
  14.                                 if (w.depth == current)
  15.                                 {
  16.                                         w.depth = start;
  17.                                 }
  18.                                 else
  19.                                 {
  20.                                         current = w.depth;
  21.                                         w.depth = ++start;
  22.                                 }
  23.                         }
  24.                 }
  25.         }

emperor1412

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
Re: NGUI 3.0
« Reply #47 on: September 24, 2013, 08:34:17 AM »
@emperor1412: The issue has been fixed with 3.0.0c (released).

That's great, what a good new, everything in my game is about sprite animation. Before 3.0.0, there were an issue like if 1 sprite in a panel is moveing then the whole geometry of the panel is rebuild, like that there is a huge performance lost every frame. Now although I'm not so sure how you batched sprite together and manage their geometry, but the problem seem to be solved. Can you talk a little bit about it.

One more thing is before I separate sprites by panel, manage the depth within a panel, each panel has different transform.position.z, but now as I see in previous post, it won't work anymore, the depth has to me manually managed over. All the widgets will be created at runtime and it turned out that all of them have the same depth which cause incorrect rendering.
I tried NormalizeDepths() at run time but it doesn't help to adjust the depth of widgets correctly. Is there a way to deal with it?
« Last Edit: September 24, 2013, 09:01:35 AM by emperor1412 »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI 3.0
« Reply #48 on: September 24, 2013, 09:28:41 AM »
You can just have your logic set the depth based on the Y position on the screen, or however else you were setting that Z.

As for what I changed... that's a long-winded question, and too much to talk about in this post. I'll just say that I redesigned how the batching is done for 3.0.

nzen

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 30
    • View Profile
Re: NGUI 3.0
« Reply #49 on: September 24, 2013, 11:48:04 AM »
Adjusting the Border setting for sliced sprites doesn't seem to update in realtime anymore, so you have to uncheck/check "Fill Center" to see it update.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI 3.0
« Reply #50 on: September 24, 2013, 12:29:58 PM »
You must be still on 3.5.7, nzen.

nzen

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 30
    • View Profile
Re: NGUI 3.0
« Reply #51 on: September 24, 2013, 03:11:15 PM »
I'm using 4.2.1 making my own atlas with a clean project. The border adjusting fixed after adding another image to the atlas.

But now it's having all kinds of issues building atlases. Everytime I Add/Update an image it breaks some of the others that aren't selected. And it resets any settings in UIAtlas. I'm remembering to save the scene after changes too.

Here's a video of it — http://www.youtube.com/watch?v=En72eunmAKM

ArvoAnimi

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 8
    • View Profile
Re: NGUI 3.0
« Reply #52 on: September 24, 2013, 03:50:43 PM »
Same border settings and atlas crazyness issue here. But besides that, version 3 screams awesomeness all over.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI 3.0
« Reply #53 on: September 24, 2013, 06:01:14 PM »
3.0.0d is what fixed atlas issues.

Yukichu

  • Full Member
  • ***
  • Thank You
  • -Given: 3
  • -Receive: 8
  • Posts: 101
    • View Profile
Re: NGUI 3.0
« Reply #54 on: September 24, 2013, 07:10:35 PM »
OMG why didn't I just come here like 4 hours ago or something.  Atlas issues fixed.

nzen

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 30
    • View Profile
Re: NGUI 3.0
« Reply #55 on: September 24, 2013, 07:30:36 PM »
Yes, it's fixed now!

mishaps

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 65
    • View Profile
Re: NGUI 3.0
« Reply #56 on: September 24, 2013, 10:16:53 PM »
aren, the new notify bit in UIButton is very cool how u choose the method from a drop-down now! Getting rid of all my UIButtonMessage... happy days! Thank you!

ArvoAnimi

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 8
    • View Profile
Re: NGUI 3.0
« Reply #57 on: September 25, 2013, 08:43:15 AM »
Thanks Aren, will check latest version, and Congratulations on getting married!

Edit: Tried to download latest version but it's not 3.0.0d but 3.0.0c ... How do I get version d again?
« Last Edit: September 25, 2013, 08:54:02 AM by ArvoAnimi »

Tiktaalik

  • Newbie
  • *
  • Thank You
  • -Given: 7
  • -Receive: 0
  • Posts: 39
    • View Profile
Re: NGUI 3.0
« Reply #58 on: September 25, 2013, 01:42:08 PM »
Using the 4.3 beta there's one error warning that is easy enough to resolve but I wanted to make sure my "fix" is reasonable.

In NGUITools.cs we have this bit of code that doesn't account for 4.3

  1. #if UNITY_EDITOR
  2. #if UNITY_3_5 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2
  3.                                 UnityEditor.Undo.RegisterUndo(t, "Make Pixel-Perfect");
  4. #else
  5.                                 UnityEditor.Undo.RecordObjects(t, "Make Pixel-Perfect");
  6. #endif
  7.  

Which I fixed by adding in:

  1. #if UNITY_4_3
  2.                                 UnityEditor.Undo.RecordObject(t, "Make Pixel-Perfect");
  3.  

I'm basically guessing at what what I'm supposed to do here. Having 4.3 call "RegisterUndo" gave me a warning that suggested that this new "RecordObject" function existed, but upon googling I couldn't find any information about it at all. This fix at least does get rid of the error and warning.

Is there some resource where new Unity API changes are listed? I have access to the Unity Beta Testing Google group, but searching for "RecordObject" yielded nothing.

soofaloofa

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 27
    • View Profile
Re: NGUI 3.0
« Reply #59 on: September 25, 2013, 03:32:37 PM »
I'm trying to upgrade my project and continuously have errors where my widgets cannot find the new scripts. (i.e. Missing Mono Behaviour on all widgets).

Steps I take:
1) Open new Scene.
2) Delete NGUI folder.
3) Import NGUI.
4) Double click on the NGUI 3.0.0 package.
5) Reopen NGUI Scene.

- All of my references are lost. Am I doing something wrong?

Thanks,

Kevin