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

[Official]New UI System.... coming in Unity 4.6

Discussion in 'General Discussion' started by Tim-C, May 28, 2014.

  1. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,081
    Unless the player is going to be dragging multiple items at once, you could probably handle that with a simple array and a couple of offsets to compensate for the location of the bag, then a single button. That's how I'd do it, at least.
     
  2. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,551
    Hmmm, I meant that the problem with such a system is having a very lengthy list in the hierarchy window, if each sprite/button/gui widget is a game object. EDIT: Unless you mean we can turn sprites into just variables in an array instead of in a gameobject?
     
  3. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,649
    Yes, of course. It's exactly the same as with SpriteRenderer at the moment; you can have one SpriteRenderer, and a MonoBehaviour with a Sprite[] array, and set SpriteRenderer.sprite in response to things happening.
     
    rakkarage likes this.
  4. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,081
    That's absolutely what I mean. It's how I handle pretty much all my inventory systems at this point. Accessing an array and just building tiles and doing everything behind the scenes is generally more efficient and easier to manage in development.
     
  5. calmcarrots

    calmcarrots

    Joined:
    Mar 7, 2014
    Posts:
    654
    Guys the truth is.... the new GUI is coming out in 4.6. But 4.6 will never be released.
     
    mog-mog-mog likes this.
  6. Nikola-B

    Nikola-B

    Joined:
    Jan 31, 2014
    Posts:
    42
    I am looking forward to the release of Unity 4.6 and the new uGUI but I am also looking forward to using it in conjunction with TextMesh Pro. Such a powerful tool when it comes to handling text.

     
  7. jvo3dc

    jvo3dc

    Joined:
    Oct 11, 2013
    Posts:
    1,520
    Would it be possible to extend the event system to send these events through the GUI event system? I'm talking about two finger zoom or two finger drag events for example that are not just read through input.touches, but that are actually sent as events to GUI elements based on their position.

    Lets take an example. Say I have a GUI item that shows a 2D map. When you use two (or more) fingers on this map, I want you to be able to zoom and/or drag the map. When you use two (or more) fingers outside of the map, I want you to be able to change the view direction and/or field of view of the camera. You could even do both at the same time.

    I understand that multi touch events are a bit trickier to handle then classical mouse events, but it would really be great to have those too.
     
  8. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,551
    My bad, I haven't fiddled around with the Unity 2d system yet, that sounds good.
     
  9. rakkarage

    rakkarage

    Joined:
    Feb 3, 2014
    Posts:
    683
    wow! excellent!

    if i make a button i can choose spriteSwap or animation
    or both by adding two button components
    because i wanna swap sprites and animate the label when pressed

    1. is there a better way then adding two button components?

    2. the button provides a nice ui to hookup to onClick but how can i hook up to other button events like pointerEnter & Exit?

    thank you
     
  10. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,773
    Animations can swap sprites. In other words, changing colors and swapping sprites are the fast easy ways, but animations can do everything.
     
    rakkarage likes this.
  11. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,649
    What StarManta said. You'd set up animations that did both the spriteswap *and* the label movement in the same animation.

    As far as other button events are concerned, different controls offer different events; if you want something like pointerEnter and the button doesn't provide it, then you'd need to make your own custom button control for it. You could do this by deriving from the official button control - something like:

    Code (csharp):
    1.  
    2. public class EnterableButton : UnityEngine.UI.Button
    3. {
    4.    // Create an event type for 'button entered' events
    5.    public class ButtonEnteredEvent : UnityEvent<EnterableButton> { }
    6.  
    7.    // Create a public variable for the event, which will show up in the Inspector
    8.    public ButtonEnteredEvent onEntered;
    9.    
    10.    public override void OnPointerEnter(PointerEventData eventData)
    11.    {
    12.       // Fire the event
    13.       onEntered.Invoke(this);
    14.  
    15.       // Let the button handle PointerEnter normally
    16.       base.OnPointerEnter(eventData);
    17.    }
    18. }
    19.  
     
    rakkarage likes this.
  12. Rodolfo-Rubens

    Rodolfo-Rubens

    Joined:
    Nov 17, 2012
    Posts:
    1,197
    Will we be able to make small tweaks using the arrow keys?
     
  13. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    Will the GUI have a style or skin, e.g a menu has a group of buttons and text labels that share a set of common elements, color, font, image, sfx. Changing large groups of buttons and GUI elements could be made simple if you could have a style group allowing you to change all of the elements in the group from one location?

    I suppose a style or skin is very similar to a prefab but the main difference is that a style/skin would be limited to formatting information e.g font and font size not text.
     
  14. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,614
    Styles should work across prefabs. A prefab is about content/functionality, a style would be about presentation. I can certainly see value in having dedicated style management stuff.
     
    zombiegorilla likes this.
  15. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    9,042
    Agreed. You could sorta pull off styles with prefabs (title_prefab, subtitle_prefab, etc...) but it would be bulky. For small projects/tools I still use the OnGUI stuff, and built a rudimentary CSS type class that uses GUIStyle. It would be useful if something similar was available on in the GUI.
     
  16. rakkarage

    rakkarage

    Joined:
    Feb 3, 2014
    Posts:
    683
  17. rakkarage

    rakkarage

    Joined:
    Feb 3, 2014
    Posts:
    683
  18. Andy-Touch

    Andy-Touch

    A Moon Shaped Bool Unity Legend

    Joined:
    May 5, 2014
    Posts:
    1,479
  19. AwesomeX

    AwesomeX

    Joined:
    Sep 10, 2013
    Posts:
    115
    Please tell me 4.6 is coming soon.

    I mean, come on. What's taking so long lol.
     
  20. Andy-Touch

    Andy-Touch

    A Moon Shaped Bool Unity Legend

    Joined:
    May 5, 2014
    Posts:
    1,479
    It's coming soon.
     
    zombiegorilla and rakkarage like this.
  21. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,773
    Since UnityGUI and uGUI are completely different systems, wouldn't that not be the correct place to ask questions about uGUI?
     
    rakkarage likes this.
  22. baustin27

    baustin27

    Joined:
    Feb 21, 2014
    Posts:
    12
    I was meaning after it was already built and the end user was using it.
     
  23. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    will there be any native tool to help us convert IMGUI to uGUI?
     
  24. mog-mog-mog

    mog-mog-mog

    Joined:
    Feb 12, 2014
    Posts:
    266
    Do we have a list of tutorials for upcoming uGUI? I've seen one video with an overview, can anyone please share consolidated list if any?
     
  25. Nanity

    Nanity

    Joined:
    Jul 6, 2012
    Posts:
    148
    I doubt this is even possible.

    But the transition would be so much easier if the delegates accepted enums and booleans, not just strings and integers.
     
    rakkarage and shkar-noori like this.
  26. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,649
    Oh. You mean like letting them type a string into a text field somewhere, and then all buttons on-screen with text that includes that string getting highlighted? Seems like kind of a niche case… I don't see the uGUI team adding out-of-the-box support for that, but I don't think it would be too hard to build it yourself on top of their foundation.
     
    baustin27 likes this.
  27. Asdlkjqweo

    Asdlkjqweo

    Joined:
    Jul 14, 2013
    Posts:
    20
    Without reading this whole thread, does the unity4.6 will come in patch?
     
  28. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
  29. CaoMengde777

    CaoMengde777

    Joined:
    Nov 5, 2013
    Posts:
    813
    lol when is it going to be out?

    now i REALLY want this...
     
    Last edited: Aug 3, 2014
  30. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
  31. smitchell

    smitchell

    Joined:
    Mar 12, 2012
    Posts:
    702
    How did you guess that date?
     
    shkar-noori likes this.
  32. Sebioff

    Sebioff

    Joined:
    Dec 22, 2013
    Posts:
    218
    It's the last day of Unite 2014, which would be a fitting event for releasing a new version or at least announcing a proper release date.
    http://unity3d.com/unite/unite2014
     
  33. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,676
    My guess is August 25. I think 4.6 will be announced and shown at Unite - on day 1 - then made available for download on the following Monday.
     
  34. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,081
    October 21, 2015.
     
    peterdeghaim likes this.
  35. Nims

    Nims

    Joined:
    Nov 11, 2013
    Posts:
    86
    While being impressed by what I have seen so far in the videos I'm worried about the things I didn't see.

    Just watching carefully through the video, I can't see how text is adjusted for different resolutions (Unlike the images which seem to be stretched according to anchor placements). Text seems to get a font size and that's it. Any changes to game resolution will retain the same font size.
    Is there an option to set the size of the text to retain a certain proportion of the screen, so we don't have to change the font size according to each device/screen we output to?
    How does exactly using "Best fit" work with text?

    Would have also been very happy to see the implementation of guides and external rulers for each canvas game object.
     
    Last edited: Aug 4, 2014
  36. Andy-Touch

    Andy-Touch

    A Moon Shaped Bool Unity Legend

    Joined:
    May 5, 2014
    Posts:
    1,479
    That is what the 'Best Fit' toggle is for; it will re-adjust the text to 'best fit' to its parent object's size(If the text is anchored via a percentage of the parent's width/height). ive attached a screenshot of the same title strip resized to different sizes, with it's text set to 'Best Fit'.

    When Best Fit is enabled, you are also able to set a Min/Max text size so that your text doesn't scale to be too big or too small. :)
     

    Attached Files:

  37. Andy-Touch

    Andy-Touch

    A Moon Shaped Bool Unity Legend

    Joined:
    May 5, 2014
    Posts:
    1,479
    I am willing to bet £1-million that uGUI will not ship on this date. :)
     
  38. smitchell

    smitchell

    Joined:
    Mar 12, 2012
    Posts:
    702
    Would you be willing to bet it would be before that date? ;)
     
  39. Andy-Touch

    Andy-Touch

    A Moon Shaped Bool Unity Legend

    Joined:
    May 5, 2014
    Posts:
    1,479
    Yes. Any takers of this bet?
     
  40. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    @Andy Touch So this literally means that uGUI will be out before Unite, right?
     
  41. Ricks

    Ricks

    Joined:
    Jun 17, 2010
    Posts:
    650
    I would really like to know how much time difference is between the releases 4.6 and 5.0. Or could it happen that 5.0 is released before 4.6 ?
     
  42. Andy-Touch

    Andy-Touch

    A Moon Shaped Bool Unity Legend

    Joined:
    May 5, 2014
    Posts:
    1,479
    4.6 will be out before 5.0.
    5.0 will have new GUI in it aswell. :)
     
  43. resequenced

    resequenced

    Joined:
    Apr 17, 2014
    Posts:
    67
    All they've said is that they won't be released on the same day. Since 5.0 hasn't even gone to beta yet (again, confirmed by UT), you can safely assume that 4.6 will be out before 5.0.

    My guess is that 4.6 will be announced during the keynote on Aug 20 and available immediately.
     
  44. adam718

    adam718

    Joined:
    Mar 11, 2012
    Posts:
    58
    Yes, I am here, i will bet for this date for sure.
    Unity 4.6 will not come in summer as Unity Tech says.
    Amount is 10,000USD.
     
  45. Ricks

    Ricks

    Joined:
    Jun 17, 2010
    Posts:
    650
    Ok, it's just that I don't want to upgrade/adjust a project 2 times in a row. So not sure if I should wait for 5.0 or take the plunge for 4.6. Guess we have to wait until 20th August anyways^
     
  46. Per

    Per

    Joined:
    Jun 25, 2009
    Posts:
    460
    I guess not many people read the year on that post...
     
    tango209 likes this.
  47. Andy-Touch

    Andy-Touch

    A Moon Shaped Bool Unity Legend

    Joined:
    May 5, 2014
    Posts:
    1,479
    I am willing to to bet $10,000 that Unity 5 will ship before 21st October 2015. Any takers?
     
  48. Whippets

    Whippets

    Joined:
    Feb 28, 2013
    Posts:
    1,775
    Really? Bet not taken, but that seems very fair - how about 4.6?
     
  49. Andy-Touch

    Andy-Touch

    A Moon Shaped Bool Unity Legend

    Joined:
    May 5, 2014
    Posts:
    1,479
    Well, that's the U5 date that Murligod proposed. :D
     
  50. ForgottenCheese

    ForgottenCheese

    Joined:
    Dec 1, 2013
    Posts:
    40
    Don't feel forced to upgrade your project every time a new version comes out. Only update if you really need one of the new features, otherwise your better off continuing on w/e version you were on. Avoids the early-bird bugs and having to update already written code.
     
    angrypenguin and zombiegorilla like this.