Search Unity

NGUI (Next-Gen UI) -- demo final feedback request

Discussion in 'Assets and Asset Store' started by ArenMook, Dec 8, 2011.

Thread Status:
Not open for further replies.
  1. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Hi Aren,

    I am wondering if NGUI things that are offscreen are taking any CPU? I have about 7 NGUI panels in my main game scene. Normally only the main HUD panel is onscreen, but profiler is telling me that UIPanel.LateUpdate is taking 10+ ms per frame on my iPhone 3GS, which seems excessive to me. Also I have UIWidget.Update taking 2ms. Anything I should look for to improve this? And if the offscreen panels are taking CPU, is there a way to disable that? Most of these panels are not able to be marked as "static" because things move around when they are onscreen and that doesn't work with static.

    Thank you!
     
  2. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Yes, things that are off-screen are eating the same amount of CPU as things that are on-screen.

    I apologize guys, but I am in China right now so the support is going to be very limited until I get back. Please use the NGUI forums to ask questions -- other people can help you there.
     
  3. adam718

    adam718

    Joined:
    Mar 11, 2012
    Posts:
    58
    Hi! ArenMook.
    I'd like to make 4 status buttons list as in Windward.
    Could you tell me whether NGUI supports that control?
    If not, I will really thank you for any simple tips how to make it...

    $01.png

    Thank you,
    Adam.
     
  4. zhuchun

    zhuchun

    Joined:
    Aug 11, 2012
    Posts:
    433
    Hi Aren, I'm a using the Font Maker(with BMFont) to build a font, including lots of Asian characters and amount is more than 30k.
    There're too many characters so I have to use a big texture in BMFont(more than 2k*2k pixels), so that font maker can import it from one png file.
    The problem I met is if Font Maker import a big texture generated by BMFont, it will go blur.
    And the bigger it is, the worse it is.
    But considering amount of characters and necessary font size, I don't know how to make the texture smaller or clearer.

    Can you please help? Thanks!
     
  5. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Look into the Packed Font feature. There is a video on it.
     
  6. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    @adam: Those buttons aren't buttons, they're checkboxes that look like buttons. These checkboxes have an option group root set, and option can't be none.
     
  7. Dreamer

    Dreamer

    Joined:
    Mar 8, 2011
    Posts:
    67
    Since I didn't get any response on here. ArenMook just ignored it. I registered a account on NGUI forum and want to ask the question there. But it is pending for approval for 5 days! And I can't post in the forum until its approved.

    ArenMook. Are you trying to block me from reporting a potential bug so don't need to spend time working on it?
     
  8. zhuchun

    zhuchun

    Joined:
    Aug 11, 2012
    Posts:
    433
    Thanks for quick reply, the video is very useful :)
     
  9. Anh-Pham

    Anh-Pham

    Joined:
    Feb 7, 2012
    Posts:
    35
    Can you fix the "get" function of "currentLanguage" in Localization.cs like this:

    From:
    PHP:
    currentLanguage startingLanguage;
    To:
    PHP:
    if (startingLanguage != string.Empty) 
    {
        
    currentLanguage startingLanguage;

    else 
    {
        
    currentLanguage Application.systemLanguage.ToString();
    }
    Thank you
     
  10. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    I am in Beijing right now, able to access internet via a very slow 3G connection. There is a post on the forums about it saying the support will be limited until the 12th. If you didn't get your account activated on the forums, then you likely registered from an IP address that has been flagged for spam -- such as a university. PM me the name you registered with and I will have a look at it.

    In regards to your original post, there is no performance issue here. Clipping each widget would indeed cause a performance drop. When you're dragging a draggable panel, no clipping occurs, so the geometry doesn't need to be rebuilt or clipped, resulting in much faster performance.

    @Anh Pham: That would be a no, I can't. The name can be anything you want it to be that references a file in your project. Plus having it separate from system language allows you to switch the language in-game without affecting the rest of your system. If you need this functionality, modify it on your end... that's why NGUI comes in source code form after all. :)
     
  11. Dreamer

    Dreamer

    Joined:
    Mar 8, 2011
    Posts:
    67
    Thanks for the clarification. My id in NGUI forum is fgame. What are you doing in Beijing? :)

    $1.png $2.png

    I have attached the screenshot to show the issue. (I have copied some items in the grid)
    As you can see, the first Screenshot is the normal stauts with 3.8k tris. The second Screenshot is the status during dragging, the tris jumpped to 9.2k. Which means at the moment, all the tris of items that are NOT showing on screen are also included in rendering.

    You won't notice it on PC but on mobile it is a big performance impact, Frame rate drops to <10 when dragging. Especially when you have 30k tirs to be clipped.
     
  12. Anh-Pham

    Anh-Pham

    Joined:
    Feb 7, 2012
    Posts:
    35
    Thank you for your respond.
    I think it's better if you force programmer use System Language Enum for name of languages. They are regular.
    I wrote a new class extend Localization for avoid conflict when I update the new version of NGUI. but it will be inconvenient when I work with new projects.

    Btw, our current project requires cutting the sprite (NGUI sprite) to 2 pieces. Do you have some suggestions for me?
    Thank you!
     
  13. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    @Dreamer: extra 6k triangles is nothing, even on a mobile device. If it was 100k+, then I would worry. If you are experiencing some performance issues, this isn't the cause. Also keep in mind that I've tested that example on mobiles -- Asus Infinity Tablet, Samsung Galaxy S3, and Samsung Tab 2. None of them show a noticeable performance drop when dragging. Framerate stays pretty consistent throughout.

    @Anh Pham: Changing it to what you suggest will completely break people's current set up, so no, I will never do this. As I said, if you need this change, make it locally yourself. As for the sprite cutting, I am not sure what you mean.
     
  14. Dreamer

    Dreamer

    Joined:
    Mar 8, 2011
    Posts:
    67
    This is a bug and you are just ignoring it.
    7k is sure not a problem, but I just use it to demo it. I am talking about the tris amout that will impact the performance a lot.
    You are using tablets and latest S3 to test, their CPU is faster.

    I am 100% sure the cause is because of this bug. Image the tris are sudduently jumpped up, and those are now supposed to show are also rendered. Something like this is a bug, you are ignoring, its fine.
     
  15. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Aren, if this is in fact a bug and you coded it wrong before, just fix it. The fact that fixing a bug will break people's current implementation of incorrect code is a non-issue. Every time I have upgraded NGUI I have had to tweak a couple things to get it working again as before. It just goes with the territory. People are never forced to upgrade NGUI though and if they do, they can expect to have to fix some things as outlined in your release notes. Also, the above poster is correct. Testing only on tablets will not give you the full picture. The iPhone 3GS is the oldest supported iPhone and it has very particular bottlenecks that do not happen on the majority of tablets. I'm sure Android phones are similar in this regard as well.

    If it's not a bug, then accept my apology in advance. I do make software for a living as you do.
     
  16. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    It's not a bug, it's intentionally coded this way. As soon as the drag process begins, culling is flat out disabled to improve performance. This way the buffers don't have to change every frame as you drag stuff around. This results in far better performance than before, when widgets were getting culled.

    If you don't believe me, open up UIPanel, and replace line 691:
    Code (csharp):
    1. if (!mCulled  shouldCull) mCheckVisibility = true;
    simply with:
    Code (csharp):
    1. mCheckVisibility = true;
     
  17. Anh-Pham

    Anh-Pham

    Joined:
    Feb 7, 2012
    Posts:
    35
    Thank you!
    I mean I want to cut the NGUI sprite to 2 pieces like this:
     
  18. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    You will need to code that logic yourself, likely with a custom widget.
     
  19. blaze

    blaze

    Joined:
    Dec 21, 2011
    Posts:
    211
    I think that you can try to use Turbo Slicer. But I dont know how it works with planes.
     
    Last edited: Oct 17, 2012
  20. Anh-Pham

    Anh-Pham

    Joined:
    Feb 7, 2012
    Posts:
    35
    Thank you all. I will try to do it by myself
     
  21. lggmonclar

    lggmonclar

    Joined:
    Oct 17, 2012
    Posts:
    14
    Hello everyone, the company I work with bought NGUI a few days ago and we're loving it. It really makes the tiring process of building an interface that works for many devices a breeze.


    My question is about creating atlases, and how some textures behave when calculating the atlas' size. We have many textures that ended up adding to a 2048x2048 atlas. The problem is, when we tried to add one 1280x40 texture, the atlas became a 2048x4096, even considering that there were more than 2048 pixels in height that were just transparent, not being occupied by any sprite. Whilst when we changed this same texture to be 1024px in width or under, the atlas remained at 2048x2048.

    Anyway, getting to the question... What is the logic behind the calculation of the atlas' size when really big textures like this are added? (even when it is only really big in one dimension).

    Thanks!
     
  22. CrazySi

    CrazySi

    Joined:
    Jun 23, 2011
    Posts:
    538
    I'm really struggling with drag and drop with NGUI. I have a set of slots and want to drag items inbetween. Yes I've seen the demo. Are there any tutorials out there for this?
     
  23. Dot45

    Dot45

    Joined:
    Jan 27, 2010
    Posts:
    33
    Are there any ways to use scroll bar with text list? and update scroll bar from length of text list?
     
  24. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    @Iggmonclar: That's Unity's logic. It doesn't deal with long narrow sprites well. Is there a particular reason why you need to have such a long sprite? Can't you get away with breaking it up into smaller pieces, or just 9-slicing it? If not, consider not putting it into an atlas. You can use a simple texture (UITexture) to draw a texture outside of the atlas.

    @CrazySi: I've answered this very question twice on NGUI forums in the past 2 days. Do a search there.

    @Dot45: Text list was meant as an example, and was created before scrolling and scroll bars were implemented. Yes you can tie the two together, but you will have to code. I recommend creating a more elegant chat window with labels added to a UITable that's within a clipped panel -- you can then get scrolling for free.
     
  25. CrazySi

    CrazySi

    Joined:
    Jun 23, 2011
    Posts:
    538
    A bit of feedback for you:

    NGUI looks great and has some really nice features, BUT:
    This is a very difficult project to use for more than just simple buttons. And documentation...what documentation?
    I have wasted 2 days with this, I wish I just wrote my own.
    It looks great, and if you can reverse engineer each example you may get what you need.
    This feels more like an opensource project than a working, complete component.
     
  26. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Last edited: Oct 19, 2012
  27. tgraupmann

    tgraupmann

    Joined:
    Sep 14, 2007
    Posts:
    828
    I've been having good success with NGUI on iOS. I was banging my head against memory limits by loading too many atlases at the same time.

    I found that I wanted to keep atlases below 2k textures and load one at a time.

    I added a script to stream the atlas textures in from the StreamingAssets folder.

    When I'm finished with an atlas, I destroy the temp texture.

    And then before I publish I set all the atlas textures to None.

    It would be nice if streaming was built-in to NGUI.

    When you hit a memory limit on iOS, the app just crashes and exits.

    You get a few out of memory warnings and then boom.

    After I upgraded to the latest NGUI I had a much better time. The thumbnail picker is great.

    There are a few issues like when you inactivate a panel, you get null ref errors if you try to inspect them.

    In the sprite picker when I double click an item, I'd like the thumbnail picker to close. I wind up with a million rogue thumbnail picker windows. And then if I deactivate the panel, the thumbnail pickers log errors. If I deactivate a panel, the thumbnail picker should close on its own.

    In UICreateWidgetWizard.cs I'd like OnSelectAtlas and OnSelectFont to be public. This lets me add custom menu items that can pop up the wizard with my own defaults for the font and atlas.

    I'd like to be able to set a 2k cap in the NGUI UI and get a warning if my atlas gets too big.

    Overall NGUI makes it very quick to build front-end interfaces.
     
    Last edited: Oct 19, 2012
  28. CrazySi

    CrazySi

    Joined:
    Jun 23, 2011
    Posts:
    538
  29. lggmonclar

    lggmonclar

    Joined:
    Oct 17, 2012
    Posts:
    14

    Thanks for your answer :)

    Yes, that's exactly what we have done, the sprite's been broken into a pattern and its working nicely. The question was more about WHY this happens, not so much as how to solve it, because you've already provided many tools for solving this kind of issue.

    Anyway, I'm still wondering why Unity handles these types of sprites the way it does, because it wasn't a very intuitive issue to begin with. I was thinking if you knew more about it and could share?

    Thanks again!
     
    Last edited: Oct 19, 2012
  30. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    I am not familiar with that code as it's inside Unity. You can try using the alternate packing method that comes with NGUI by unchecking a checkbox on the atlas maker -- it may have better results.
     
  31. MentalFish

    MentalFish

    Joined:
    Nov 2, 2005
    Posts:
    282
    Is there a way to control the line height of the text in multiline labels?
     
  32. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Yup, you can change it by selecting your font.
     
  33. Dot45

    Dot45

    Joined:
    Jan 27, 2010
    Posts:
    33

    i made that before , using clipped panel and UITable together but the labels won't be clipped.
     
  34. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Labels not clipping may mean a few things:
    - GLES 1.1 target = no shader support
    - There are extra panels present. Labels must not have a panel in between of them and the clipped panel in the hierarchy.
    - Scales leading up to your labels are not uniform. They must be uniform. (1.23, 1, 1) is not uniform, but (1.23, 1.23, 1.23) is.
     
  35. Dot45

    Dot45

    Joined:
    Jan 27, 2010
    Posts:
    33
    don't understand this one. you meant if labels are child and mother is clipping panel then i cannot have panel in the same level as labels , correct? if yes, my clipping panels has only labels inside, no sub panel but still cannot be clipped.

    oh and another problem is clipped panel's clipping center is moved when i drag scroll bar. i only want to drag panel not clipping center(the pink box)
     
    Last edited: Oct 22, 2012
  36. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Clipped panels are "moved" by adjusting the clipping rectangle's center by +A, and transform by -A. This way the geometry actually stays in place and doesn't need to be rebuilt, resulting in much better performance.

    One other thing to check: NGUI shaders must be in the Resources folder. If you moved them somewhere, clipping won't work because shaders won't be loadable.

    http://www.tasharen.com/forum/index.php?topic=1940.msg9701#msg9701
    http://www.tasharen.com/forum/index.php?topic=2032.msg10115#msg10115
     
  37. adam718

    adam718

    Joined:
    Mar 11, 2012
    Posts:
    58
    Hi Aren.
    I'd like to make tab control.
    I did it like following.
    - make two checkboxes (for tab item)
    - make two panels (for tab content)
    - when checking checkbox, enable/disable panels. (using buttontween)

    The problem is when enable panel, childs are enabled too (even if uncheck "Include Children")
    I don't want child to be enabled because child is also tab and have disabled child inside it.
    I should make tab inside tab, so above way is not right I thoght.

    Could you help me how to make tab control?
    Adam.
     
  38. Dot45

    Dot45

    Joined:
    Jan 27, 2010
    Posts:
    33


    this what i mean , it seems that the clipping area is move to the UILabel or UITable's position which is a child of draggable panel.
     
    Last edited: Oct 24, 2012
  39. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Tab inside a tab? Not sure what you mean. Just place your panels beside each other, not parented to one another:

    - Your window
    --- Tab 1
    --- Tab 2
    --- Panel 1
    --- Panel 2
     
  40. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Try making your clipped panel's size smaller on the X -- make it a tight fit, just about matching the width of your labels.
     
  41. Dot45

    Dot45

    Joined:
    Jan 27, 2010
    Posts:
    33
    i fixed it , it seems that it only works with UIDraggablePanel's scale (1,1,1) , if i changed the scale to (0,1,0), the clipping area will shift again.
     
  42. adam718

    adam718

    Joined:
    Mar 11, 2012
    Posts:
    58
    Sorry to make you hard to understand.
    Could you explain me simple way how to make tab then?
     
  43. felix_berninger

    felix_berninger

    Joined:
    Aug 19, 2011
    Posts:
    30
    hi. i like your package and it offers me great help.

    now i really need to know if there is a way to change the alpha of a simpletexture. because we are loading pictures via www (from outside of the project) and want to change their visibility. same goes for movie textures.

    the color tint or material color doesn't have any effect on this.

    sorry if this has been answered before.
     
    Last edited: Oct 24, 2012
  44. Stephan-Tanguay

    Stephan-Tanguay

    Joined:
    Jan 27, 2011
    Posts:
    21
    Fading in panels should be included as basic functionality for any GUI system.

    I am a big fan of NGUI since they make building GUI's in Unity3D much more flexible and efficient...

    it was shocking to find out I have to use their built in tween engine to change the alpha ( but I can see why, there is no standard material exposed) Not having a way to directly tween the alpha of a panel is even more mind blowing.

    Great plugin with a few missing features required for GUI work. I love NGUI and would love to see them fix the lack of a fade panel function.

     
  45. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    @adam: I thought I just did? o_O

    @xfelax: Change the shader used by your simple texture. "Unlit/Transparent Colored" will allow you to change its alpha.

    @Stephan: UIPanelAlpha is a script that comes with NGUI.
     
  46. adam718

    adam718

    Joined:
    Mar 11, 2012
    Posts:
    58
    I am sorry. (^*^) What do you mean?
     
  47. G5IsBack

    G5IsBack

    Joined:
    Oct 25, 2012
    Posts:
    2
    Hi guys,
    I have got a problem with scrollview in NGUI, I have a button on top and a Draggable Panel on center, on Panel there is a Vertical ScrollView with a lot of items which attach colliders, I make that colliders front of button collider by adjust z-coordinate.
    When I drag thump of scrollbar by downward, the button cannot be clicked-the colliders move above and are front of button collider.
    I cannot make button collider front of that colliders because when drag panel over the button, the button still be clicked, plz help me!
     
  48. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Guys, if you need support related to NGUI, please use the NGUI support forum. Answering questions in this thread is a little futile as others can't benefit from my answers in the future (as it's nearly impossible to search it).

    G5: This gets asked frequently. Yesterday, for example: http://www.tasharen.com/forum/index.php?topic=2108.0
     
  49. G5IsBack

    G5IsBack

    Joined:
    Oct 25, 2012
    Posts:
    2
  50. legven

    legven

    Joined:
    Oct 28, 2012
    Posts:
    1
Thread Status:
Not open for further replies.