Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

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

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

  1. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,661
    You see the part at the top of the profiler that says "Memory usage in the editor may not be as it is in the Player"?

    Anyway, talking about and posting screenshots of stuff that's in 4.6 is either an NDA violation - so you should shut up - or you're using a leaked copy of 4.6 which is still in beta and may have bugs in - so you should shut up. Either way, shut up.
     
  2. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,120
    Well, if I was a moderator I'd probably have you banned for NDA violation.
    But maybe that's why I'm not a moderator...
     
    Ostwind likes this.
  3. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    1) Yes
    2) Yes
    3) I'm not sure I understand, it works like a normal monobehaviour
    4) 'Summer'
    5) It will be in free.
     
    Jingle-Fett likes this.
  4. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    Just like the 2D system we build an atlas at build time. So we have low draw calls also.
     
  5. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    Out of the box we don't have this in the touch module currently, but it can be added by extending the module, and it is something we would like to do in the future.
     
  6. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    Yeah, we have some bugs with prefabs atm, we are hammering them out though :)
     
  7. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    Not in version 1, it can be added at a user level though.
     
  8. Silly_Rollo

    Silly_Rollo

    Joined:
    Dec 21, 2012
    Posts:
    501
    Does it use a two camera setup like NGUI/Daikon or can you render everything to one camera without worrying about GUI elements being covered?
     
  9. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Good question...
     
  10. cannon

    cannon

    Joined:
    Jun 5, 2009
    Posts:
    751
    Hi Tim,

    Just a couple of questions, are the following supported by uGUI?

    1. Multi-screen support for displays where height > width, e.g. two monitors vertically positioned, useful for kiosks.
    2. Support for Kanji and other oriental character sets; these usually require either multi-atlas support or packed font atlases (each channel supporting a separate character range)

    Also, will the 4.x cycle finally support touch for Windows 8+, or will we have to integrate TouchScript into uGUI ourselves on Windows 8?
     
  11. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    So whats the latest with 4.6?
    Must be on final beta builds or even RC?
     
  12. Whippets

    Whippets

    Joined:
    Feb 28, 2013
    Posts:
    1,775
    "Summer" is June 21st to September 21nd (northern hemisphere according to yahoo answers), so that's our time period for 4.6 release. Obviously, I'd like it sooner rather than later XD
     
  13. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    You render in multiple ways:
    1. Screen space UI - Renders last and over the top of everything in orthographic projection
    2. Screen space perspective - Renders at the end of a configured camera, using the perspective / settings of the camera
    3. Worls space, renders in the world (like a billboard).
    You can use a custom camera OR an existing camera, we try to be flexy in this area.
     
  14. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    1. We are using existing Unity rendering tech, so whatever is currently achievable is achievable with the new UI.
    2. We use dynamic fonts / existing unity text rendering. So as long as it works with 'normal' unity text it will work in the new UI.
    I'm not sure about windows 8 things, I don't know much about what the platform team is up to. I do know they are working hard though.
     
  15. Silly_Rollo

    Silly_Rollo

    Joined:
    Dec 21, 2012
    Posts:
    501
    Is render order determined by a shader or is it configurable? Something like say I want to render particles with the UI elements but on top of them, could I attach a component to set its render order or would I need a custom UI particle shader?
     
  16. goat

    goat

    Joined:
    Aug 24, 2009
    Posts:
    5,182
    I don't like to be a naysayer but based on 4.5 that I've tried on Windows 8.1 & OS X 10.7.5; 4.6 and Unity GUI is late summer and I really wouldn't mind waiting past summer for 4.5 problems to be fixed as so much that follows is dependent on it.

    Also, I'm in no way a beta tester for any version of Unity unless you consider these released versions on the patch cycle to be beta.
     
  17. AllonVR

    AllonVR

    Joined:
    Jul 16, 2012
    Posts:
    28
    Will we be able to use the new UI system in Editor Windows?
     
  18. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,777
    No. GUI.Whatever and GUILayout.Whatever stuff will still be the way to do those.
     
  19. AllonVR

    AllonVR

    Joined:
    Jul 16, 2012
    Posts:
    28
    That's a shame. I hope that at least the documentation will improve for using the old GUI system in custom editors.
     
  20. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,777
    The old GUI is much better suited to the Editor than it is for games, and honestly is better suited to the Editor than uGUI appears to be. Immediate-mode lets the editor script adjust instantly and accurately to changes made on objects no matter how the changes are made, and it doesn't require that you include a bunch of Editor GUI assets when you distribute a plugin (everything is in just the script). And the issues we've had with the old GUI (harder to make it pretty and harder to make it animate nicely, and the huge performance issues on mobile) simply don't matter in Editor scripts.
     
  21. willgoldstone

    willgoldstone

    Unity Technologies

    Joined:
    Oct 2, 2006
    Posts:
    794
    For anyone who missed the update to the OP by Tim, he and I just released a shiny new video showing you guys 3D UI with the new tools.



    ENJOY!
     
  22. scarpelius

    scarpelius

    Joined:
    Aug 19, 2007
    Posts:
    966
    I would like to know if the new gui have the ability to apply a css/style format to words in a text element, create links, anything that is necessary to create a functional chat.
     
  23. Jaroslav-Stehlik

    Jaroslav-Stehlik

    Joined:
    Feb 20, 2012
    Posts:
    485
    Is it possible to read sorting order during runtime?
    Will be there some hirearchy change event in editor for sorting updates?

    I have 2d system which works with opaque geometry beacuse of reducing fillrate
    Because I can't manually sort them without offseting Z value because of zbuffer discarding pixels.
    So I would like to hook up to the transform order index to change my z value.

    I have done my own z manager which works almost same as yours but unity editor does not expose enough events
    For my purpose.
     
  24. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,120
    Very nice video! Thanks!
    I've noticed what seems to be the solution to the alpha issue I mentioned earlier in this thread. As the rest of the GUI looks perfect to me, that alpha issue is the only thing that bothers me at the moment.
    So... I have a few questions about the Canvas Group. Can you please reveal a bit more info on how it works?
    I noticed that it traverses the whole hierarchy and doesn't stop on it's first child level, which is good! But how exactly does it apply its alpha to its children? Is it in an update function?
    What happens if I have another script on a child text label, which increases and decreases text alpha to create a blinking effect? Will this Canvas Group conflict with that blinking script? Do I have to change the execution order?
    If I have another Canvas Group as a child, how is its alpha affected? Does the parent Canvas group affects its child Canvas Group alpha or it's children directly?
     
  25. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,777
    I suspect (I haven't played with it, but this would be the "correct" way to do it) that this goes the other direction. When a UI element is queried by the renderer as to what its alpha is, it probably sees if there's any group objects above it in the hierarchy, and the result that's returned is child alpha * group alpha. That's more efficient, more robust, and best of all, non-destructive. So if you have a group with a text object at 100% alpha and a texture at 50% alpha, setting the group's alpha to 50% will make those objects appear 50% and 25% respectively, while the inspector for those elements will still show them at 100% and 50%.
     
  26. Artem-Koval

    Artem-Koval

    Joined:
    Mar 18, 2011
    Posts:
    6
    Hi!

    What kind of controls will be included? It would be extremely nice (if not crucial) to see such common controls as progress bar, list box, tabbed panel and so on.

    Thanks, Artem.
     
  27. shinymark

    shinymark

    Joined:
    Aug 7, 2011
    Posts:
    66
    I'd like to learn more about performance and memory usage in a future blog post or video. One of our issues with NGUI is significant allocation when enabling a deep UI hierarchy, for example to show a pop-up when the user presses a button in the UI. It makes me wonder about...
    1. UI system memory usage (ignoring textures).
    2. Runtime allocations.
    3. Any special memory/performance impact of using animation components on UI to translate and scale.
     
  28. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,120
    Yes, I agree with that and that's what I suggested earlier in the thread. But you can't do it with a simple script, can you? As far as I understand, this needs changes to the "internal" UI rendering pipeline.
     
  29. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,777
    Can't do what with a simple script?

    If were trying to implement a system like this in a custom GUI system, you could easily do it with OnWillRenderObject and GetComponentsInParent
     
  30. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,120
    Ok, I feel stupid now. I wasn't aware of the pre and post rendering event functions.
    So if that's how it actually works, then it seems to be a great solution!
     
  31. CatchCo

    CatchCo

    Joined:
    Nov 27, 2012
    Posts:
    17
    Since the new GUI is being developed alongside 5.0, is there a chance that 5.0 will not have the new GUI at first? I imagine 5.0 is under a lot of time pressure.

    Brandon
     
  32. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,646
    Why would you think that? Even the thread title says it's coming in 4.6.
     
  33. trumpfan

    trumpfan

    Joined:
    May 28, 2014
    Posts:
    1
    Looks like it'll be quite easy to transition from NGUI to this system, cool
     
  34. MrDude

    MrDude

    Joined:
    Sep 21, 2006
    Posts:
    2,569
    I would love to see a webview. I would like to render my existing web page in my game gui and interact with my website via a web view in my game... I know there are some packages like that from 3rd parties but an integrated webview would be a game changer for me... No pun intended

    Imagine, you will, the ability to log into your game account using twitter or g+ or facebook without having to open up a web browser app and then returning to your game afterwards... Or having an online virtual store where customers can buy stuff outside the game but they use the same interface in game also... I can think of so many uses... I have seen people asking for the ability to parse html and css with this system but that is not what I'm after... Just the ability to render a web page inside my game and being able to complete input fields and click buttons... Being able to do that natively....

    But I guess the new gui is all about a new WAY of doing guis, not about new things added to the gui so I guess I am out of luck. Oh well... :(
     
    Last edited: Jul 1, 2014
  35. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225

    Canvas Group Alphas are applied recursively (and the values are cached), if you modify the alpha of a canvas group then we rebuild the GUI batch and recalculate the alpha for the elements under the group. If you have a canvas group and an element within the group the result alpha of the element will be canvas group alpha * element alpha. So you can have the element blink as you wish within the limits of of the canvas group alpha.
     
  36. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    We are using standard Unity Rich Text (http://docs.unity3d.com/Manual/StyledText.html) for the UI system, we will be expanding upon this in the future.
     
  37. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    If you put the elements on a canvas then you have access to the z ordering depth.
     
  38. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    UI system memory Usage:
    If you have a relatively static hierarchy then memory usage is 'known' as you would just be enabling / disabling things. The more elements you have the more memory it will use, but for the most part our components are paired down and orthogonal. So you only pay for what you need in terms of memory

    Runtime Allocations:
    Normal usage is currently close to 0 (not quite there yet, but almost). There is no reason the UI system should allocate in normal workflows. It of course would allocate if you dynamically create new elements ect.
     
  39. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    Why would we ship 4.6 with gui and 5.0 without? We get a fun job or merging it back every few weeks :)
     
  40. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    I'll take this as a comment. The library is extensible so someone out there may feel like writing their own web view ;)
     
  41. senritsu

    senritsu

    Joined:
    Dec 12, 2012
    Posts:
    37
    Will there be a way to do a curved GUI canvas?
    This would be really nice for in-helmet style HUDs, for example for the oculus rift.
     
  42. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    940
    @Tim C

    Is there a new way to rended better lines?
     
  43. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,120
    Can you have nested Canvas Groups?
     
  44. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    Out of the box everything is build using 'Rects' (rect transforms) BUT that's just for main layout, the verts that get generated do NOT have to coplaner with this. So for example you can write a script that modifies the generated vertices:

    Code (csharp):
    1.  
    2. public class VertBend : BaseVertexEffect
    3. {
    4.    public float scale = 10f;
    5.    public float amplitude = 35f;
    6.    public float phase = 0f;
    7.    
    8.    public override void ModifyVertices(List<UIVertex> verts)
    9.    {
    10.      if (!IsActive ())
    11.        return;
    12.  
    13.      for (int index = 0; index < verts.Count; index++)
    14.      {
    15.        var uiVertex = verts[index];
    16.  
    17.        uiVertex.position.z = Mathf.Sin (uiVertex.position.x * scale + phase) * amplitude;
    18.        verts[index] = uiVertex;
    19.      }
    20.    }
    21. }
    22.  
     
    adamhill likes this.
  45. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    Out of the box we don't have anything like vector rendering or svg :( We have not done anything special with line rendering for 4.6
     
  46. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    Yes
     
  47. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,307
    I've been pretty vocal about how long the new GUI has taken, but I have to admit that the level of ease of use might make it have been worth the wait if that video is any indication.
     
  48. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,120
    That's great! Thanks!
     
  49. The-Spaniard

    The-Spaniard

    Joined:
    Jan 7, 2012
    Posts:
    149
    Whilst I imagine implementing vector rendering or svg is a lot of work, I think a LineRenderer2D would probably be pretty easy, merely requiring that the billboarding behaviour is turned off, clamping the verts to the same z plane, and for the points input to accept the new RectTransform. This would go a long way to plug the gap.

    (also, add some getters: http://forum.unity3d.com/threads/line-renderer-getting-parameters-by-scripting.253941/)
     
  50. ortin

    ortin

    Joined:
    Jan 13, 2013
    Posts:
    221