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

    nsxdavid

    Joined:
    Apr 6, 2009
    Posts:
    476
    Biggest thing I am seeing that's missing from the "CORE" is some convenience methods to create widgets from code. I know you can do it from instancing prefabs, but that creates a dependency and some extra steps.

    Also it's not clear how a prefab version of a widget knows what panel it belongs too. Since a prefab cannot reference a scene object... does it just create its own panel? That'd seem to break the whole 'minimize the drawcall' thing. But I'm just guessing here.

    David
     
  2. nsxdavid

    nsxdavid

    Joined:
    Apr 6, 2009
    Posts:
    476
    Regarding paypal vs. asset store....

    Yeah the review thing is a problem. I went ahead and bought it twice so I could write a review. Honestly, $65 or whatever is too cheap for this thing anyway, so I had no problem paying a more fair price.

    No real way around it and still get the fast-update service. :/

    David
     
  3. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    @nsxdavid: Someone has too much money ;)

    You can attach the creation script to your panel game object, and have it reference a prefab. Then inside the script when you create instances of your prefab, just parent them to the game object the script resides on.
     
  4. LKIM

    LKIM

    Joined:
    Feb 17, 2011
    Posts:
    40
    I'm confused - in the ScrollList example, you have a UIGrid which has a set of items which are children of the grid.

    Those items do not have UIWidgets attached to them, but some of their children do.

    How do I go about getting the actual size of the item and all of its children? I tried to use the bounding box, but that was on the wrong scale.

    Thanks,
    ~Liron
     
  5. gregmax17

    gregmax17

    Joined:
    Jan 23, 2011
    Posts:
    186
    I don't think I will be able to give a review because I purchased it on PayPal, darn. Well, if I did...

    BUY this! It is by far the best GUI editor for Unity. It makes creating menus fun :)

    Back to feedback now...

    I agree with nsxdavid, some methods to create widgets from code sounds very nice.
     
  6. markhula

    markhula

    Joined:
    Sep 3, 2011
    Posts:
    630
    Hey Aren,

    Think I'll wait for v1.3 with new OnState stuff; as it's a real problem. And yes, I have multiple buttons that 'communicate' with each other (e..g I've been pressed the rest of you guys get off screen).
    I can't think of a 'nice' solution. But as you seem to be feature obsessed (in a nice way!) and I'm guessing 1.3 isn't that far away given an update appears every few days. I shall wait as I am certain you'll deal with these kind of 'touch' issues in a much more elegant fashion.
    I also tried to do a review but can't because paid via paypal :-(((
    Nearly bought EZGui, glad I didn't! ;-)

    Cheers
     
  7. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    @LKIM: Try this:
    Code (csharp):
    1.     static public Bounds CalculateWidgetBounds (GameObject go)
    2.     {
    3.         UIWidget[] widgets = go.GetComponentsInChildren<UIWidget>() as UIWidget[];
    4.  
    5.         Matrix4x4 mat = go.transform.worldToLocalMatrix;
    6.         Bounds b = new Bounds(Vector3.zero, Vector3.zero);
    7.  
    8.         foreach (UIWidget w in widgets)
    9.         {
    10.             Vector2 size = w.visibleSize;
    11.             Vector2 offset = w.pivotOffset;
    12.             float x = (offset.x + 0.5f) * size.x;
    13.             float y = (offset.y - 0.5f) * size.y;
    14.             size *= 0.5f;
    15.  
    16.             b.Encapsulate(mat.MultiplyPoint(w.transform.TransformPoint(new Vector3(x - size.x, y - size.y, 0f))));
    17.             b.Encapsulate(mat.MultiplyPoint(w.transform.TransformPoint(new Vector3(x - size.x, y + size.y, 0f))));
    18.             b.Encapsulate(mat.MultiplyPoint(w.transform.TransformPoint(new Vector3(x + size.x, y - size.y, 0f))));
    19.             b.Encapsulate(mat.MultiplyPoint(w.transform.TransformPoint(new Vector3(x + size.x, y + size.y, 0f))));
    20.         }
    21.         return b;
    22.     }
     
  8. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    1.30 is currently scheduled for Wednesday, although I may push it until Thursday, depending how much time I get as my primary focus is still supporting you guys. I should also probably mention that with NGUI getting closer and closer to what I'd call the "feature-complete" stage the price of the kit will be going up, as I've gotten some suggestions that when comparing the prices of the certain higher-priced UI kit people think they "get what you pay for", which in this case doesn't hold up.

    1.30 will feature a convenience menu that can be used to create a skeletal hierarchy of common components with appropriate scripts already attached (think NGUI -> Add menu, but instead of a single script it adds several game objects with appropriate scripts). This will make it easier for you all to create common components such as buttons, sliders, checkboxes, etc.

    As for creating stuff via code: can you give me some examples of what you'd like to see? So far I was just going to expose the 1.30 convenience menu functionality to the code as well.
     
  9. helioxfilm

    helioxfilm

    Joined:
    Apr 23, 2008
    Posts:
    259
    Scrollable containers (or similar solution to build complex shops) will be included in this build?
     
  10. markhula

    markhula

    Joined:
    Sep 3, 2011
    Posts:
    630
    Aren,

    That sounds great. May I ask how all the OnState stuff will be dealt with? (you mentioned a revamp).
    Although simple, I think the addition of auto texture atlas choosing (like EZgui) i.e. hi/low res would be cool; simply picking up the appropriate one based on filename.

    Cheers
     
  11. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    @helioxfilm: Example 2 shows a scrollable container and you can put anything you like in there. Do you mean something else?

    @markhula: OnState will give way to a bunch of small and to-the-point scripts that are meant to work with each other. Currently OnState is very abstract, which is both good and bad. Good for complex systems, but bad at being straightforward. I'll post more details when I flesh it out.

    NGUI 1.28c features a tools function to swap one atlas with another: NGUITools.ReplaceAtlas(before, after);

    You can use it at run-time to swap low-res atlas for a high-res one.
     
  12. markhula

    markhula

    Joined:
    Sep 3, 2011
    Posts:
    630
    Oh man!
    Now this is what I call support! :)))
    I've bought things before (asset store and 'other' dev stuff) and well; support is crap (Scott of Chipmunk fame being an exception); other BAD one's I won't mention!
    Great Aren; can't wait! - and yes, put the price up man!!!! :)

    Cheers
     
  13. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    1.28c is up on the asset store btw, so both PayPal and AssetStore are currently sporting the latest version (from this morning).
     
  14. Kalagaraz

    Kalagaraz

    Joined:
    Aug 26, 2009
    Posts:
    46
    ArenMook, sent you an e-mail :)
     
  15. LKIM

    LKIM

    Joined:
    Feb 17, 2011
    Posts:
    40
    So my test is going well - thanks for the help. My advanced UIGrid is mostly working.

    Is there a way to receive some sort of notification (or a way to poll) an item to determine whether the size is currently changing?
     
  16. helioxfilm

    helioxfilm

    Joined:
    Apr 23, 2008
    Posts:
    259
    Yes I know that example, but is is somehow much more simple than that I need to build by myself. In my other thread http://forum.unity3d.com/threads/117736-Which-GUI-solution-to-choose?p=794895#post794895 we talked already about my needs - so that multiple items in a line solution I need - but, maybe I should just go ahead and buy your NGUI and try to build it. A short tutorial on building such things would be anyhow very-very warmly welcomed :)
     
    Last edited: Jan 9, 2012
  17. Kalagaraz

    Kalagaraz

    Joined:
    Aug 26, 2009
    Posts:
    46
    What does this "UIGrid" do, it interests me :)
     
  18. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    @LKIM: Nope, it's currently silently handled by the system. You will probably want to notify your custom grid script at the time when you are changing something instead.

    @helioxfilm: The scrollable grid you have in that example can be simplified. Since it takes up pretty much the entire screen I would suggest you simply have it be a part of your main UI, and have higher depth "border" widgets cover it up on the top and bottom edge of the screen, thus creating a smooth transition.

    @Kalagaraz: It simply arranges all game objects that are children of the game object the script is attached to into a grid based on cell width and height you specify.
     
  19. mindlube

    mindlube

    Joined:
    Oct 3, 2008
    Posts:
    993
    Wow- that's scary. I hope you are keeping track of all these crazy workarounds!

    btw- unrelated question about Unity 3.5. Any chance you can implement multi-editing support for NGUI widgets? That would be really cool.
     
  20. LKIM

    LKIM

    Joined:
    Feb 17, 2011
    Posts:
    40
    Basically just spaces the items by some fixed amount of padding instead of just defining some fixed size for all of the items. It's a very simple test I'm doing just to see the viability of NGUI.

    Once I figure out how to receive notifications of size changes, I think I'll post it.
     
  21. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    @mindlube: This will have to wait until 3.5 ships. :) I don't want to fill the code with #ifdefs unless it's for a work-around.
     
  22. Kalagaraz

    Kalagaraz

    Joined:
    Aug 26, 2009
    Posts:
    46
    Read the post about NGUI price going up after a next updates or so, will those of us who already bought it have to pay the additional amount to continue getting updates?
     
  23. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Nope, all updates are always free.
     
  24. mindlube

    mindlube

    Joined:
    Oct 3, 2008
    Posts:
    993
    Thanks for the quick fix, by the way. It seems fine in 1.28c :)
     
  25. LKIM

    LKIM

    Joined:
    Feb 17, 2011
    Posts:
    40
    You can actually do it like this - OnUpdate
    Code (csharp):
    1.  
    2.     TweenScale[] widgets = GetComponentsInChildren<TweenScale>();
    3.     foreach(TweenScale w in widgets)
    4.     {
    5.       if(w.enabled)
    6.       {
    7.         repositionNow = true;
    8.       }
    9.     }
    10.  
     
  26. nsxdavid

    nsxdavid

    Joined:
    Apr 6, 2009
    Posts:
    476
    Convienence methods would be something along the lines of CreateUISprite(). Now what arguments it needs and where that lives... I don't know. But the point is that a UISprite is returned that is fully setup and working ready to be positioned (and possibly reparented), etc.

    Regarding prefabs instancing of Widgets...

    I've got this situaiton where I have 2D objects in 3D space that represent various effects or pickups (like a 2D image of a coin or whatever).

    What I'm doing is instancing the prefab for it and positioning it in 3D space (with the layer set to main camera visible) parented to some other 3D object that it needs to be relative too. Actually I have it as a child in a prefab heiarchy come to think of it.

    This works just fine. Thing works as expected.

    But... is it batching? Or is it creating a separate panel for each?
     
  27. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    You can navigate up the hierarchy from the widget in question until you find a UIPanel. UIPanel is what batches widgets together. It's added to the root-most object by default, but you can create your own panels if you so desire.
     
  28. nsxdavid

    nsxdavid

    Joined:
    Apr 6, 2009
    Posts:
    476
    You might need to read that a bit closer. There is no hierarchy with a panel in the case I am describing.
     
  29. Alahmnat

    Alahmnat

    Joined:
    Feb 1, 2008
    Posts:
    65
    I have a question about scrollable views before I buy this, because it's the one thing I need most in the UIs I'm building...

    The second demo shows a scrollable view in an orthographic camera (2D UI), and it's my understanding that the scroll view is handled by using a separate camera to draw the scrolling area? In that case, is it possible to create a scrollable view in a 3D UI component? I have a number of in-world objects that display holographic UI elements in world-space, and many of them have lists of items that need to be scrolled through. I'm all over the rest of this toolkit, especially at this price, but I really need this sort of capability. Is this something NGUI supports, or can be added in a future release?

    Thanks :)
     
  30. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    It has to have some hierarchy. You said it yourself you are parenting it to a 3D object. What is the 3D object parented to? Does it all end up as children of some game object, for example "Scene"? If so, "Scene" is what will have the UIPanel. If the 3D objects aren't parented to anything common then they will each create a UIPanel when a widget is attached to them. You may still end up with only 1 draw call from it all if dynamic batching is turned on, but I'd recommend parenting them to a common source so you don't rely on dynamic batching.
     
  31. nsxdavid

    nsxdavid

    Joined:
    Apr 6, 2009
    Posts:
    476
    It's parented to nothing. Changing how that works would be too complex at this point. I am using dynamic batching tho.
     
  32. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    @Alahmnat: It sounds like you need a clipping area that restricts widgets to its dimensions. It's on the list and is a planned feature, and with the current list of tasks it will likely be added around version 1.32.
     
  33. helioxfilm

    helioxfilm

    Joined:
    Apr 23, 2008
    Posts:
    259
    Clipping area +1

    I just purchased NGUI via PayPal and now looking for the e-mail to be able to start using it :)
     
  34. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    The email should be sent to you instantly. If you don't see it, it may have gotten caught in your spam filter.
     
  35. helioxfilm

    helioxfilm

    Joined:
    Apr 23, 2008
    Posts:
    259
    No, I have doublechecked, so far only the PayPal confirmation has arrived.
     
  36. Alahmnat

    Alahmnat

    Joined:
    Feb 1, 2008
    Posts:
    65
    Awesome, thanks Aren :)
     
  37. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Well, this makes it at least 3 people that want the clip area, I suppose I can bump it up the list.
     
  38. quitebuttery

    quitebuttery

    Joined:
    Mar 12, 2011
    Posts:
    329
    Weird, it lets me review it--but not give it a star rating. Well, at least I gave it a good review! Maybe it will let me star it after downloading the latest update.
     
  39. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Are you using 3.5b6? I heard you can only rate in 3.4.2. Thank you btw :D
     
    Last edited: Jan 9, 2012
  40. helioxfilm

    helioxfilm

    Joined:
    Apr 23, 2008
    Posts:
    259
    Now it has arrived. It seems there was a lag in my system, because your mail was sent immediately, but arrived only an hour later to me:)
     
  41. mydingefnysen

    mydingefnysen

    Joined:
    Dec 15, 2011
    Posts:
    51
    +1 for clipping area from me too!

    @nsxdavid: Talking about helper methods to create sprites, I think its going to be tricky to make something that works for everyone. I made a simple UIManager with a method that works like this:

    UISprite closeButtonWidget = (UISprite)UIManager.AddUIWidget<UISprite>(parentGO, spriteName);

    Give it a parent object (that was previously added to the UIManager through AddTo2DLayer) and a spritename, then it is setup and works. The UIManager takes care of downloading atlases, definitions files, creating atlases and fonts, creating basic hierarchy and UIPanels and stuff like that.

    Its really basic, but its enough to get me started using NGUI with just code.
     
  42. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Alright, alright, I am working on it right now... :)

    That's a pretty good idea, mydingefnysen... gives me an idea for an even better one:
    - Game Object in the scene with a bunch of inactive (disabled) children and a UITemplate script attached.
    - Each child object is a template you've set up -- Button, Slider, Checkbox...
    - In code do UITemplate.Create(gameObject, "Button").
    - The UITemplate class checks -- does it have a child called "Button"? Yes? Create a copy of it and all of its contents and parent it to 'gameObject'.

    Fully customizeable, fully dynamic, and still easy to use. The UITemplate object can be a prefab you can drag into any scene.
     
  43. Kalagaraz

    Kalagaraz

    Joined:
    Aug 26, 2009
    Posts:
    46
    Ok something odd is happening again :(. Was adding a label, and it worked fine. Was displaying on top of all my sprites (My sprites are at depth 2 for the window, and I put the label at depth 3. Then all of a sudden it just disappered while I was creating another label. Couldn't get it back in front no matter how much I raised depth. So I deleted them both and created another label, still can't get it to show above the window...

    What did I do wrong this time? :(
     
  44. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Make sure they are all parented to the same object. Ie:

    Root
    - Label 1
    - Label 2
    - Sprite

    ...etc
     
  45. Kalagaraz

    Kalagaraz

    Joined:
    Aug 26, 2009
    Posts:
    46
    comfirmed, they are all under root.

    Could be unrelated, but I'm getting a bunch of GUI errors now too:


    "GUI Window tries to begin rendering while something else has not finished rendering! Either you have a recursive OnGUI rendering, or previous OnGUI did not clean up properly."

    "rc.right != m_GfxWindow->GetWidth() || rc.bottom != m_GfxWindow->GetHeight()"
     
  46. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    That's unrelated, Unity does it sometimes. Do all your widgets and labels use the same atlas? If you are using multiple atlases you have to adjust the transform's Z instead (less than ideal). Also ensure that all your widgets are drawn by the same UIPanel. Navigate up to your root -- it should be there. Uncheck the gizmos and hidden checkboxes, and select the geometry. If all of it gets selected, then it's all one draw call.
     
  47. Kalagaraz

    Kalagaraz

    Joined:
    Aug 26, 2009
    Posts:
    46
    Same atlas, I have a gameObject called 2D UI, it holds the camera and root, the panel was put on 2D UI. Everything is using same UI panel.
     
  48. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Obvious question -- is the label scaled properly?
     
  49. Kalagaraz

    Kalagaraz

    Joined:
    Aug 26, 2009
    Posts:
    46
    I'm sorry, all the tiles are not on the same panel. For some reason when I copy and pasted the row of tiles, to stack them up to form a window, they got put on a seperate panel somewhere but I have no idea where that panel is. They are still under 2D UI -> root -> Sprites + Labels, but still seem to be on seperate panels. There a way to move them to correct panel?
     
  50. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Yup. Just delete the incorrect UIPanel script.
     
Thread Status:
Not open for further replies.