Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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. Mark_T

    Mark_T

    Joined:
    Apr 25, 2011
    Posts:
    303
    I really like NGUI. Being a "3D GUI" it gives you a bit more freedom.
    My problem is that I`m not a programmer. Even so, I bought it. I`ll just have to find somebody to integrate it for me with Playmaker. Some other user asked you about that (a Playmaker connection) and I have the feeling you were not very enthusiast about that. And most of the feedback you get is from programmers not from artists(at least that is my impression).
    I have a feeling that you`ll have more customers with a NGUI-Playmaker version added to this one. Al least I will gladly pay 50% for an NGUI-Playmaker addon (upgrade).
     
  2. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    My only reservation comes from the fact that I don't have Playmaker and don't know much about it. :) If the author of that tool is willing to work with me, I'd love to make our packages work well with each other. Question though -- using Playmaker with NGUI, what is currently not possible that you'd like to be?
     
  3. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,085
    Trying to build a button that the player can hold down to move forward.

    This is my previous temporary code using Unity GUI:

    Code (csharp):
    1.  
    2.         if (GUI.RepeatButton(new Rect((Screen.width - (2 * buttonSize)), (Screen.height - (2 * buttonSize)), buttonSize, buttonSize), "F"))
    3.         {
    4.             if (!Player.instance.isMoving)
    5.             {
    6.                 StartCoroutine(Player.instance.MoveForward());
    7.             }            
    8.         }
    9.  
    That was working fine, so I've tried this in NGUI:

    Code (csharp):
    1.  
    2.     void OnPress(bool isDown)
    3.     {
    4.         if (isDown)
    5.         {
    6.             if (!Player.instance.isMoving)
    7.             {
    8.                 StartCoroutine(Player.instance.MoveForward());
    9.             }              
    10.         }
    11.     }
    12.  
    It only fires once though. Assumed isDown would be true so long as the player continued to hold down the button?
     
  4. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    You need to save the state passed in OnPress, then check it in Update. If true, move the player. No need for co-routines.
     
  5. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,085
    OK cool - I'm happy enough with this for now. Working nicely:

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class GoForward : MonoBehaviour
    6. {
    7.     private bool isDownState;
    8.    
    9.     // #################################################################################################
    10.     // ONPRESS
    11.     void OnPress(bool isDown)
    12.     {
    13.         isDownState = isDown;
    14.     }
    15.    
    16.     // #################################################################################################
    17.     // UPDATE
    18.     void Update()
    19.     {
    20.         if (isDownState)
    21.         {
    22.             if (!Player.instance.isMoving)
    23.             {
    24.                 StartCoroutine(Player.instance.MoveForward());
    25.             }
    26.         }
    27.     }
    28. }
    29.  
     
  6. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Remove the StartCoroutine. Just call Player.instance.MoveForward().
     
  7. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,085
    No - that part's all good. It has to do with the way I'm animating the character's movement. All working fine.
     
  8. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Ah, alright.
     
  9. reissgrant

    reissgrant

    Joined:
    Aug 20, 2009
    Posts:
    726
    Great price for a great looking tool!
     
  10. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    For the next week or so I'm going to be focusing primarily on support and on keeping my schedule open to fix any and all issues that may be found. New features will start trickling in again after christmas, with a new shiny example showing off an interesting effect that can be achieved in Unity Pro - refractive windows.
     
  11. mindlube

    mindlube

    Joined:
    Oct 3, 2008
    Posts:
    993
    Um I'm afraid this doesn't work. Prime31's MiniJSON.cs is underneath Plugins. It defines class extensions, e.g. arrayListFromJson(). Those class extensions are needed by other stuff in Prime31 Plugins, e.g. GameCenter/GameCenterAchievement.cs

    It seems like you have forked the MiniJSON class by adding some Sprite specific stuff into it, and it cannot live in Plugins (because that is a separate compilation unit). I think NGUI needs to ship with a differently named MiniJSON like NGUI_MiniJson. This is the only workaround I can think of to get NGUI working with the various prime31 plugins I'm using.
     
  12. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Sure, I can do that.
     
  13. mindlube

    mindlube

    Joined:
    Oct 3, 2008
    Posts:
    993
    Awesome! curious to see the shiny refractive gui example :)
     
  14. mindlube

    mindlube

    Joined:
    Oct 3, 2008
    Posts:
    993
    Actually not sure if that's the best solution or not given all the static methods and references in MiniJSON. Maybe move LoadSpriteData and CopyInnerRect into another class thereby enabling MiniJSON to be moved into Plugins/ ? I'll play around with it and let you know when I get it working.
     
  15. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    No need, just grab an updated package (if you got it via PayPal). Asset store will be updated when they approve it.
     
  16. mindlube

    mindlube

    Joined:
    Oct 3, 2008
    Posts:
    993
    Thanks! Unfortunately I bought via the Asset Store :( They should really allow faster updates. What was the fix just to rename the class as I originally suggested?
     
  17. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Yup, renamed it to NGUIJson.
     
  18. mindlube

    mindlube

    Joined:
    Oct 3, 2008
    Posts:
    993
    OK I got it working... I think. I had to remove the MiniJSONExtensions class from your file, because they are extension methods on string, Hashtable, Dictionary, etc. they are ambiguous references when the other file appeared in Plugins. I guess if you want to test it, just install one of prime31's plugins or just throw a copy of the UIToolkit MiniJSON.cs file into Plugins/ folder.

    BTW I'm really liking the NGUI so far!
     
  19. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Thanks :) -- I've done the same on my end.
     
  20. Legacy

    Legacy

    Joined:
    Oct 11, 2011
    Posts:
    651
    Hey aren, since im not on my home computer at the moment how do i reference the text value of an label that i attached the input script on. I.E textbox1.text. Just trying to write some code while its slow here at work lol.
     
  21. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    It's just UIInput.text.
     
  22. PrvtHudson

    PrvtHudson

    Joined:
    Apr 10, 2009
    Posts:
    236
    Hey Aren, when's the Christmas special start ? Only a few shopping days left ... ;)
     
  23. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Having this priced at less than 1/3rd of EZGUI as a regular price is like a year-long christmas special, no? :)

    I admit I have considered having a $10 off promotion for the holidays but ultimately didn't do it due to several reasons -- how new the package is, the delay in changing the price on the asset store, and not to upset the customers who just bought it at a full price.
     
  24. mindlube

    mindlube

    Joined:
    Oct 3, 2008
    Posts:
    993
    I think it should be
    if (mPanel != null mPanel.showGizmos)
     
  25. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    You're right, thanks. Typo.
     
  26. PrvtHudson

    PrvtHudson

    Joined:
    Apr 10, 2009
    Posts:
    236
    You had me at "1/3rd of EZGUI "
     
  27. BrUnO-XaVIeR

    BrUnO-XaVIeR

    Joined:
    Dec 6, 2010
    Posts:
    1,687
    His JSON is Prime's plus some more stuff.
    All I did was move ngui folder to plugins folder and delete Prime's JSON. Still everything works on Prime's plugins as well.
    I was annoyed by that though, it shouldnt be there anyways.
    Also, the Editor stuff must be in the main Editor folder under Assets instead of where he ships it, else Xcode project wont even compile.
     
    Last edited: Dec 20, 2011
  28. mindlube

    mindlube

    Joined:
    Oct 3, 2008
    Posts:
    993
    What's the best way to organize a bunch of "panels" or windows that need to be on screen at different times, e.g. HUD, Options, Score, Multiplayer info, etc.? I'm not sure if UIPanel is the right unit of organization, or if I should just group my panels under gameobjects under my 2D UI hierarchy.
     
  29. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    UI Root
    -- Panel 1
    -- Panel 2
    -- Panel 3
     
  30. mindlube

    mindlube

    Joined:
    Oct 3, 2008
    Posts:
    993
    @Aren, in that example are Panel 1,2,3 just empty gameobjects to contain other widgets, or they have UIPanel components? thanks
     
  31. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    They should have UIPanel on them. Root doesn't have anything (but can have the scale for your UI), and possibly UIAnchor with a half-pixel offset if the camera is not a child of the UI Root.
     
  32. angel_m

    angel_m

    Joined:
    Nov 4, 2005
    Posts:
    1,160
    In my game project I use three different cameras depending if the player is walking, driving a car or flying an aircraft and they are activated or not at runtime when it is necessary.
    I see NGUI system uses his own camera, it is going to interfere or add too much complexity to my three cameras project configuration?
    Also, all my scrips are in javascript, so, can it be a handicap for using the C# based NGUI system?
     
    Last edited: Dec 21, 2011
  33. Legacy

    Legacy

    Joined:
    Oct 11, 2011
    Posts:
    651
    It shouldnt, just make sure that your UI camera is a higher depth than the rest of the cameras and clear flags are set to depth only. Also you will create 2 layers for the ui (3d and 2d) which you will set all 3 of your cameras culling mask to everything but the 2dui and 3dui layers and the UI camera to only the 2d layer and 3d layer nothing else.
     
  34. Quickfingers

    Quickfingers

    Joined:
    Aug 29, 2009
    Posts:
    268
    Hey ArenMook, me again :) Been happily getting along with NGUI, although latest version still doesn't save my inner rect settings when I re import the text file (After adding more gfx to my atlas)

    So the process:
    I have is a prefab in my project folder (not in the scene) that has my uiatlas on it. I add more gfx in texture packer, publish the sprite sheet. Drag the new txt file into the prefabs TP Import field. all sprites look right except sliced ones which lose there previous inner rect settings.

    Any updates on this particular problem? Thanks a lot
     
  35. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    @quickfingers: It doesn't work for you even with the latest version? Odd, let me double-check.

    @angel_m: what Efraser2007 said, pretty much. :) (thanks!) -- your UI camera will have a higher depth than other cameras, and it will have its culling mask set to draw only the UI layer while other cameras should exclude the UI layer.
     
  36. mindlube

    mindlube

    Joined:
    Oct 3, 2008
    Posts:
    993
    The OP didn't mention mobile, and that seems like a nice simple solution for desktop, but I believe then at launch time both the low and high texture2d will be loaded. On mobile that would be really bad, with a 2048 + 1024 texture. Load times are slow enough on mobile as it is. It might take some fancy scripting and post processing to load from Resources. But since UIAtlas supports TexCoords it should totally be doable.
     
  37. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    You can choose which textures get loaded on mobile by loading them yourself via Resources.Load and setting the material's texture directly.
     
  38. Vern_Shurtz

    Vern_Shurtz

    Joined:
    Mar 6, 2009
    Posts:
    264
    I have been on the fence about purchasing a GUI system since Unity 3.5 was "suppose" to have a new GUI engine implemented. Now that it is confirmed that this new GUI will not make it into 3.5 it's time to go shopping. :)

    I've looked extensively at the other options but NGUI so far is at the top of my list. My main concern is how useful NGUI would be to a non-programmer or someone with limited programming capabilities like myself. I can somewhat do some Unity script and understand the way it's formatted but C# still makes my eyes cross. Learning C# is on my list to do so programming in NGUI may be my way of finally learning it. I've looked at the tutorials and it looks like quite a bit can be done out of the box without the need for coding.

    Would NGUI be a good choice for a non-programmer or a programmer "lite"?

    By the way the videos are really good and from what I have seen the support for NGUI to date is excellent.
     
  39. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    @quickfingers: Can you give the latest package a try? (same download link via the website) -- I double tested and ensured that the inner rects are preserved.
     
  40. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    @Vern_S: You are free to use javascript for your event scripts since NGUI's event system uses SendMessage. I've designed it to be as simple as possible not just for devs but for artists as well -- but, my opinion is of course biased, so this would be a better question for those who have tried the package so far. :)
     
  41. Vern_Shurtz

    Vern_Shurtz

    Joined:
    Mar 6, 2009
    Posts:
    264
    Aren, thank you for the info.

    One package that I am definitely buying shortly is UScript. Creating NGUI event nodes for UScript would probably increase your user base. There are a few EZGui Event Nodes that have already been created for UScript. Food for thought.

    One more question I have concerns Text. How difficult would it be to to add text data using xml files? I am currently using Unity to create interactive product catalogs for mobile devices with a lot of text data that changes occasionally and editing xml files would simplify this effort. Here is an example of what I am doing.

    IS_Demo

    I am looking at creating similar products but with more interactive 3D instead of just image slides with the occasional 3D scene inserted. This way I can add realtime 3D content with the informational content. The "CMOS 3D Demo" is an example of this 3D content. You can see how NGUI would be beneficial in this type of production.
     
  42. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    You can set text at run time easily via UILabel.text property. As for uScript, it's a package I don't have, so I would need to work with someone who has it and is familiar with it.
     
  43. BrUnO-XaVIeR

    BrUnO-XaVIeR

    Joined:
    Dec 6, 2010
    Posts:
    1,687
    I think uScript have a free version.
     
  44. Vern_Shurtz

    Vern_Shurtz

    Joined:
    Mar 6, 2009
    Posts:
    264
    UScript has a Personal Learning Edition that is free and is fully functional. Only difference between the PLE and the purchased edition is a small watermark that is visible at run time. Here is the link.

    UScript PLE

    You should be able to use this version to create and test Event Nodes. Full UScript event node support would be a huge plus, IMHO. :)
     
  45. Vern_Shurtz

    Vern_Shurtz

    Joined:
    Mar 6, 2009
    Posts:
    264
    Here is a link to the UScript.net forum thread that has one of the EZGui Event Nodes that someone has created.

    EZGui Slider Event Node

    I believe you have to be registered on the forum to download the CS script for the event node.
     
  46. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    So if I understand how it works just by looking at the example script you linked, this would create a uScript node that reacts to the click event in NGUI?

    Code (csharp):
    1. using UnityEngine;
    2.  
    3. [NodePath("Events/NGUI")]
    4. [NodeToolTip("NGUI Event receiver")]
    5. [NodeDescription("NGUI Event receiver node")]
    6. [NodeComponentType(typeof(Collider))]
    7. [FriendlyName("NGUI Event")]
    8. public class NGUIEvent : uScriptEvent
    9. {
    10.     public delegate void uScriptClickHandler (object sender);
    11.  
    12.     public event uScriptClickHandler onClick;
    13.  
    14.     void OnClick ()
    15.     {
    16.         onClick(this);
    17.     }
    18. }
     
  47. kheng

    kheng

    Joined:
    Oct 22, 2008
    Posts:
    126
    Almost.

    Code (csharp):
    1. using UnityEngine;
    2.  
    3.  
    4.  
    5. [NodePath("Events/NGUI")]
    6.  
    7. [NodeToolTip("NGUI Event receiver")]
    8.  
    9. [NodeDescription("NGUI Event receiver node")]
    10.  
    11. [NodeComponentType(typeof(Collider))]
    12.  
    13. [FriendlyName("NGUI Event")]
    14.  
    15. public class NGUIEvent : uScriptEvent
    16.  
    17. {
    18.  
    19.     public delegate void uScriptEventHandler(object sender, System.EventArgs args);
    20.  
    21.  
    22.  
    23.     [FriendlyName("On Click")]
    24.  
    25.     public event uScriptEventHandler onClick;
    26.  
    27.  
    28.  
    29.     void OnClick ()
    30.  
    31.     {
    32.  
    33.          if ( null != onClick ) onClick( this, new System.EventArgs( ) );  
    34.  
    35.     }
    36.  
    37. }
     
  48. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Oh, nice. Thanks!
     
  49. Vern_Shurtz

    Vern_Shurtz

    Joined:
    Mar 6, 2009
    Posts:
    264
    UScript is pretty awesome for us non-programmer types. :)
     
  50. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
Thread Status:
Not open for further replies.