Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  4. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  5. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

New UI Widgets

Discussion in 'Assets and Asset Store' started by ilih, Feb 11, 2015.

  1. Mario020

    Mario020

    Joined:
    Jun 20, 2017
    Posts:
    22
    2017.3.1f1 Personal
     
  2. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    578
    Strange, I cannot reproduce it.

    What player settings you use for Android builds?
    And try to create ScrollView with lots of text and check will be text displayed correctly or will be visible out of bounds as ListView items.
     
  3. PeterShoferistov

    PeterShoferistov

    Joined:
    Sep 22, 2013
    Posts:
    59
    I've added the scripts but the following error appears:
    Assets/ThirdParty/UIWidgets/Standart Assets/Calendar/CalendarMultipleDates.cs(5,21): error CS0234: The type or namespace name `Attributes' does not exist in the namespace `UIWidgets'. Are you missing an assembly reference?

    Could you provide sample project or at least some scripts with your implementation?
     
  4. Mario020

    Mario020

    Joined:
    Jun 20, 2017
    Posts:
    22
    ilih likes this.
  5. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    578
    It's my mistake, this namespace now available only in beta version.
    So you need to remove this namespace with "[DataBindField]" attribute from DataSource property or update to 1.10.0b12.
     
  6. Mario020

    Mario020

    Joined:
    Jun 20, 2017
    Posts:
    22
    I am using the spinner with format 0.00 and now I want to change the value programmatically. However, unfortunately the text of the spinner is not updated and stays 1.00. (It works fine using the arrows)
    spinner.text = "4.00";
    How can I programmatically update this value?
     
  7. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    578
    You should use Value property, not text, and it will be formatted automatically.
    spinner.Value = 4;
     
  8. Mario020

    Mario020

    Joined:
    Jun 20, 2017
    Posts:
    22
    ilih Thanks, seems obvious now, mistakingly I replaced my spinnerfloat with the spinner. That's why I was fixated on the text value.
     
  9. Chrueschschie

    Chrueschschie

    Joined:
    Feb 5, 2018
    Posts:
    4
    Hello!
    I am generating TreeView ListItems programmatically (
    TreeNode<TreeViewItem>
    ). Everything works fine.
    However, the ListItems do not have the same format as the DefaultItem, which I customized. The text is still the standard yellow-ish, although the TextObject of the DefaultItem has green text. The background color of the generated ListItems is also not as I set it in the DefaultItem.
    The Toggle of the generated ListItems however is fine - it is just as I set it up on the DefaultItem.

    Am I missing something? Do I need to manipulate the TextObject and everything manually, when generating ListItems programmatically? But then again, why is the Toggle fine?

    Thanks in advance!
     
  10. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    578
    You need to change default colors in TreeView component.
    Colors applied only for Text components and DefaultItem.Image component (it's background) and this is why Toggle is fine.
    Colors needed to make default, hovered and selected items visually distinct.


    Or you can create own DefaultItem component with changed GraphicsColoring method:
    Code (CSharp):
    1. namespace UIWidgetsSamples
    2. {
    3.     using UnityEngine;
    4.  
    5.     public class TreeViewComponentCustomColoring : TreeViewComponent
    6.     {
    7.         public override void GraphicsColoring(Color foregroundColor, Color backgroundColor, float fadeDuration = 0.0f)
    8.         {
    9.             // apply custom coloring or do nothing.
    10.         }
    11.     }
    12. }
     
    Last edited: Jun 26, 2018
  11. Chrueschschie

    Chrueschschie

    Joined:
    Feb 5, 2018
    Posts:
    4
    Ah! I got it. Thank you very much. Very good support!
     
  12. RazaTech

    RazaTech

    Joined:
    Feb 27, 2015
    Posts:
    169
    Hello!!

    Is its possible if user click on any where in other then sideblock it close it self ?



    just like farmvilla when use click on anywhere other then sideblock it close it self

    if not then it would be great to have it.
     
  13. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    578
    You need to enable "Modal" option.
     
  14. RazaTech

    RazaTech

    Joined:
    Feb 27, 2015
    Posts:
    169
    its not working if you put and other canvas as content in it.
     
  15. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    578
    Sorry, not really understood.
    Can you show hierarchy window screenshot when sideblock opened, what objects have canvas components and where you click to close sideblock.
    Or maybe you miss adding Graphics Raycaster component to Canvas? Without Graphics Raycaster component clicks will be ignored.
     
  16. RazaTech

    RazaTech

    Joined:
    Feb 27, 2015
    Posts:
    169
    Hello!!


    How I Can get actual Physical GameObject From ListView dataItem ?

    for example I have flowing list and I want to get actual gameObject showing Algeria data.
    it could data index or actual that should be used to get physical item.


    upload_2018-7-6_20-34-47.png
     
  17. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    578
    You can get component by index using GetItemComponent() method, and get gameObject from it.
    Warning: component can be null if item not visible.
    Code (CSharp):
    1. var component = list_view.GetItemComponent(indexOfAlgeria);
    2. if (component!=null)
    3. {
    4.    // do something with component.gameObject
    5.    component.gameObject.name = "Algeria";
    6. }
     
  18. r618

    r618

    Joined:
    Jan 19, 2009
    Posts:
    681
    @ilih I recently decided to use uiwidgets for horizontal scrolling list/tileview thing, here're some pain points I've encountered:

    1) folder 'Standart Assets' - this folder contains scripts of the package. Name it as such, please (!). I.e. just 'Scripts' would do. ( apart from the fact that the word Standart with the 't' at the end does not exist, it's also confusing since there is Unity's own 'Standard Assets' folder )

    2) 'Sample Assets' - this folder contains example scenes, script and prefabs (see further) of the package - name it as such, please. Just 'Examples' or 'Samples' would be _perfectly_ fine

    3) 'Sample Assets' folder contains sample scenes, but also some prefabs. Why ? There is 'Prefabs' folder for this. super confusing ! ( While you're at it, get rid of 'Prefabs/Old' if they're no longer needed )
    - The prefab TileViewSample I was looking for is quite unintuitively buried in Sample Assets\TileView.
    (it's fine to have sample components just for the scene, but don't make them prefabs then, or if, do it properly with Prefabs folder)

    4) Since I needed text mesh pro I used the one of the TextMeshPro Support Packages
    That's fine if you decided to do it this way, but please make them having content parity with the main package then
    (i.e. all prefabs and example scenes) ( I might be wrong about prefabs since not all necessarily use text/labels and I didn't thoroughly review them )
    Personally I think better way would be to make components handle both (UGUI and TMPro) in single code base and let the user choose which one to use based on e.g. a project wide #define - (with the user responsibility if it's changed)
    - but there are maybe more options for this. Either way majority probably better than the the current one -)

    5) UIWidgets dirties the scene constantly which needs saving without any visible user changes (I can look up the diff if you want later)

    There are more things like this, and it's a good asset otherwise! please take this as constructive feedback
    Thanks!
     
    hopeful likes this.
  19. r618

    r618

    Joined:
    Jan 19, 2009
    Posts:
    681
    well, this probably won't work since you loose all references don't you. In that case package is probably a must
     
  20. RazaTech

    RazaTech

    Joined:
    Feb 27, 2015
    Posts:
    169
    I'm having difficulty while using SlideBlock.

    I think its probably a bug.

    you can reproduce it with following steps.

    1- slideBlock.Open() ;

    //after OnOpen
    2- slideBlock.Close() ;



    //before OnClose
    3- slideBlock.Open() ;


    and it will not open. it will remain in closed state.


    Expected behavior.



    1- slideBlock.Open() ;

    //after OnOpen
    2- slideBlock.Close() ;



    //before OnClose
    3- slideBlock.Open() ;


    and its should be opened , before OnOpen event there should be OnClosed event. where we should do our closing stuff.
     
  21. RazaTech

    RazaTech

    Joined:
    Feb 27, 2015
    Posts:
    169
    it would be great to have
    SlideBlock.OnOpeningStarted
    SlideBlock.OnClosingStarted

    events as well.
     
  22. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    578
    Thanks for your response.

    1, 2 - I want to rename those folders long ago, but I afraid that after update users will have two folders: one with the old name and new renamed, also a lot of errors about names conflict. I could not any documentation about how assets package import works with renamed folders and files.
    3 - Your right. I'll delete them.
    And maybe I replace all prefabs with scripts to create them like the default Unity widgets (this will help to avoid missing reference errors after Unity version update)
    4 - I'll think about content parity - the problem is should the prefabs and example scenes without text duplicated or not. In current version prefabs without text not copied to TextMeshPro Support Packages.
    And probably will be only one context menu instead of two: if support package installed will be used prefabs with TextMeshPro support.
    5 - What Unity version you use?
     
    hopeful and r618 like this.
  23. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    578
    Open() and Close() functions does not change state if sidebar running open or close animaton.
    You can use SetOpen() and SetClose() to change sidebar state withour animation or add the following code to Sidebar.cs and use ForciblyOpen() and ForciblyClose() to change state with animation.
    Code (CSharp):
    1.         /// <summary>
    2.         /// Forcibly open this instance with animation.
    3.         /// Already running animation will be cancelled.
    4.         /// </summary>
    5.         public void ForciblyOpen()
    6.         {
    7.             Init();
    8.  
    9.             ForciblyAnimate(true);
    10.         }
    11.  
    12.         /// <summary>
    13.         /// Forcibly close this instance with animation.
    14.         /// Already running animation will be cancelled.
    15.         /// </summary>
    16.         public void ForciblyClose()
    17.         {
    18.             Init();
    19.  
    20.             ForciblyAnimate(false);
    21.         }
    22.  
    23.         /// <summary>
    24.         /// Forcibly the animate to specified state.
    25.         /// Already running animation will be cancelled.
    26.         /// </summary>
    27.         /// <param name="shoudBeOpen">If set to <c>true</c> state will changed to open.</param>
    28.         protected void ForciblyAnimate(bool shoudBeOpen)
    29.         {
    30.             StopAnimations();
    31.  
    32.             isOpen = !shoudBeOpen;
    33.  
    34.             SetModal();
    35.             ActionAnimate[AnimationTypeInt]();
    36.         }


    I can add them, but those events will not be called if a user manually drags the sidebar because he can drag it to any state.
     
  24. r618

    r618

    Joined:
    Jan 19, 2009
    Posts:
    681
    That's not how Unity package importer works (for a (very) very long time now -)
    The importer looks at assets first (I believe according to their hashes): when you rename a folder after import, but don't change any content, the importer will not detect any change and even if you click OK in import window, nothing will be by default imported - since all assets are not checked in it when/if they're the same.
    (I think it even does not display any import tree when the folders were unchanged, but expands it if some folders were changed, but does not select any asset/s as mentioned above)

    You can easily verify this: import package into new project, rename a folder and then import it again.
    So users with (future) previous versions will be fine - it will keep the old folders, new imports will be 'correct'.
    I don't have an exact link, but it's there since 5 for sure, and very very likely in 4. For 5 and up there's no reason to not rely on this I'd say.


    Yeah, something like that, although I think you'll probably hit few obstacles, especially with serialized references in prefabs.
    A separate package is not _that_ a terrible obstacle though; and probably the easiest solution tbh since just sample scenes should be missing.

    2017 LTS, but it was there all along in 5.5/6 IIRC
    I suspect EasyLayout, but that's just a hunch didn't research this properly
     
  25. r618

    r618

    Joined:
    Jan 19, 2009
    Posts:
    681
    Oh btw the way importer does it in 2017 (don't know if it's new or not) it displays assets in user's rearranged project tree in import window
    I believe before it moved the asset in the project if user chose to import it regardless
    So, I really wouldn't worry about any duplicates ;)
     
  26. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    578
    Great.

    I found in what cases this is possible: if one of the elements under EasyLayout control change its Min, Preferred or Flexible size when its actual size changed. I'll try to find a way to avoid it.
     
  27. Felipe-Q

    Felipe-Q

    Joined:
    Oct 11, 2013
    Posts:
    2
    Hi I'm getting an error with the latest unity version.

    The items are all stacked on over the other and there is apparently a problem with easy layout

    There is a screen shot attached
     

    Attached Files:

  28. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    578
    Please try to re-import package and create widget again.
    Sometimes after import script references became broken, trying to import again, usually this is fix problem.

    If error not fixed after this I create package special for this Unity version.
     
  29. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    578
    I made a package for Unity 2018.2.2f1, you can download it here. It should not have import errors with latest Unity version.
     
  30. Keaneo

    Keaneo

    Joined:
    Mar 7, 2015
    Posts:
    43
    Hi
    Does this work in VR? I’d like to have a 3D canvas, use VRTK laser pointer to manipulate/select UI items, on Oculus Go (android). Particularly interested in the tree view.

    Thanks!
     
  31. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    578
    it
    It uses Unity UI: if default Unity widgets work so will be work New UI Widgets.

    I remembered: already was the question about VR and VRTK https://ilih.ru/unity-assets/UIWidgets/#comment-3980479093 , apparently its work, but was a small problem with a double click which easily fixed.
     
  32. Eidoboy

    Eidoboy

    Joined:
    Jul 3, 2012
    Posts:
    24
    What's the status of 1.10 development? Is a stable release coming soon? Thanks
     
  33. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    578
    40~50% done.
    Will be released at the end of this month if nothing happens.
     
    hopeful and Eidoboy like this.
  34. Felipe-Q

    Felipe-Q

    Joined:
    Oct 11, 2013
    Posts:
    2
    I tested the code with a new project and ti worked. Now I am recreating my project from zero to see what broked it.
     
  35. dagraca

    dagraca

    Joined:
    Jun 28, 2016
    Posts:
    11
    Hi
    I have the latest unity 2018.2.3f1 and I tried to update with UIWidgets.1.10.0b12-Unity2018.2.unitypackage

    but now, my listview are broken : it seems that easylayout does not compil (dont know why)
    here is the picture :
    any ideas to solve it ?

    thanks in advance
     

    Attached Files:

  36. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    578
    Please show what errors are displayed in the console? You can open it with Window - General - Console or Ctrl+Shift+C.
    Probably you will have a few errors regarding "GetBuiltinResource", those errors are safe, should be other compile errors.

    I made a package for 2018.2.3f1, please try it.
     
    Last edited: Aug 14, 2018
  37. dagraca

    dagraca

    Joined:
    Jun 28, 2016
    Posts:
    11
    Thanks for your fast answer

    I think I found the issue (but not the fix)

    start a new project, add package, add ListView prefab on scene : everything is OK !

    now go to setting, change to .NET4
    and again : add ListView prefab on scene :KO !
    ListView>ScrollRect>Viewport>List <---- here the script EasyLayout is dead

    EDIT : I finally managed to make it work on a brand new project. so I just copied all my old project in the new one... It does the job ! good continuation on your very good asset!
     
    Last edited: Aug 14, 2018
  38. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    578
    Are you drag&drop ListView from Prefabs folder?
    A better way is to use the context menu.



    I found problem: if the namespace has a class with the same name as the namespace then Unity 2018.2 ignore this class.
    To fix it you need to rename "EasyLayout" namespace to "EasyLayoutNS":
    - open EasyLayout.cs
    - place cursor at "EasyLayout" in the first line "namespace EasyLayoutNS"
    - press F2 to rename
    - change name to EasyLayoutNS

    Good.
     
  39. dagraca

    dagraca

    Joined:
    Jun 28, 2016
    Posts:
    11
    hi
    your small fix did not work (add EasyLayoutNS). Could you please create a new package with this fix ? It would be great !
    (also new unity version 2018.2.4)

    Thanks in advance

    Frederic
     
  40. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    578
    Done https://ilih.ru/unity-assets/UIWidgets/download/?f=11

    You can open EasyLayout.cs in Inspector windows to check if a problem exists.

    Unity does not recognize script if a class has the same name as the namespace.


    No problem if class and namespace have different names.
     
  41. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    578
    I have a problem with PC - it suddenly restarts. Probably this will be fixed at the end of the week.
    So the new release will be delayed to mid-September.
     
    Eidoboy and hopeful like this.
  42. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    578
    About TextMeshPro support for Unity 2018.1 and later

    The new version of TextMeshPro uses a new GUIDs and this is why support package does not work by default. You need to convert existing files to works with new GUIDs after importing the package or updating to 2018.2.
    TextMeshPro package has tools to convert files automatically:
    1. Made backup
    2. Open Window -> TextMeshPro -> Project Files GUID Remapping Tool

    3. Press "Scan Project Files" (you should change project settings to Version Control = "Visible Meta Files" and Serialization = "Force Text" if not you will see a notification)
    4. Save modified files after a scan.
     
    Last edited: Aug 30, 2018
  43. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    578
    Sorry, I underestimated the time required to finish all planned features.
    Here is pre-release 1.10.0b15.
    All requested features are done.

    In development:
    - widget generation (now available only scripts generation, use context menu "Create / UIWidget - Widget" on file with item class)
    - TextMeshPro support for the new version
    - new demo scene

    Changelog:
    - Added styles support (Styles folder, new styles can be created from context menu "Create / UIWidget - Style")
    - Added DateTime, Time24 and Time12 widgets
    - Added DateTimePicker and TimePicker widgets
    - Added ColorPickerRangeHSV widget
    - Added ColorsList widget to display list of the selected colors, should be used with ColorPicker or ColorPickerRange.
    - Added "Data Bind for Unity" support (requires Unity 5.6 or later)
    - Added base ListView Picker class for the custom ListView
    - Added base TreeView Picker class for the custom TreeView
    - Added base drop support class for the custom TreeView
    - Added base drop support class for the custom TreeView node
    - Improvement: Drag can be canceled with Cancel button
    - Accordion: added AllItemsCanBeClosed option
    - Autocomplete: added GetInputFieldText() function
    - Calendar: added DateMin and DateMax properties
    - Calendar: added currentDateAsDefault option
    - ColorPicker: added Hex block
    - ColorPicker: added new palette mode HSVCircle
    - ColorPickerRange: DefaultShader replaced with DefaultShaderHorizontal and DefaultShaderVertical
    - EasyLayout: reduced memory allocations
    - EasyLayout: EasyLayout namespace renamed to EasyLayoutNS to avoid problems with Unity 2018.2 and later
    - Interfaces: IItemWidth, IItemHeight, IListViewItemHeight, IListViewItemWidth not used anymore
    - ListView: added CenterTheItems property
    - ListView: added overridable functions CanBeSelected() and CanBeDeselected()
    - ListView: added LoopedList option
    - ListView: added Interactable option
    - ListView and TileView: ListViewCustomWidth, ListViewCustomHeight, TileViewCustom and TileViewCustomSize replaced with ListViewCustom with List Type option
    - ListViewCustomWidth: TItem now does not require IItemWidth implementation
    - ListViewCustomHeight: TItem now does not require IItemHeight implementation
    - ResizableHeader: fixed resize on touch devices
    - Sidebar: added OnOpeningStarted and OnClosingStarted, called when appropriated animation started
    - other: prefabs in "Sample Assets" folder replaced with scenes
    - other: "Standart Assets" folder renamed to "Scripts"
    - other: "Sample Assets" folder renamed to "Examples"
    - other: removed ListViewGameObjects prefab
    - other: removed outdated prefabs and sprites
     
    Last edited: Sep 23, 2018
    digiross and YuriPetskus like this.
  44. YuriPetskus

    YuriPetskus

    Joined:
    Jun 22, 2018
    Posts:
    3
    Ilya,
    are you planning to add animation support for the button? For example, increase when pressed.
     
  45. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    578
    This can be done with transitions. For now, I do not see any reason to duplicate this functionality.
     
  46. Boegi

    Boegi

    Joined:
    Dec 6, 2014
    Posts:
    11
    I know this is not the right forum to ask this question. But I saw your "transitions" answer and I see a chance to get an answer from an UI expert. In a VR App I saw a UI button and "onGaze" it was expanding into 3D. (From a 2D Button to a kind of 3D Brick) I guess this can be "coded" in some way... But maybe you have an idea or even some additional search terms for a google search? Thanks anyway... Feel free to delete this post if it is to off-topic.
     
  47. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    578
    Place 3d object behind the button and animate scale.z to convert it from flat to 3d.

    Here sample scene with a script.
    • Canvas should be with Render Mode = Screen Space - Camera.
    • Added cube into the button
    • The scale and the position changed to fit button
    • And on mouse enter added animation to change scale.z from 0 to a proper value. Same for on mouse exit.
    • Because it's cube also animated the local position.z to avoid intersections with button after scaling.
     
    Boegi likes this.
  48. Boegi

    Boegi

    Joined:
    Dec 6, 2014
    Posts:
    11
    Wow - I did not expect such a perfect solution and also such a fast answer ;-)
    Thanks 1000 times... I will try this tomorrow - it already sounds very good.
     
  49. dagraca

    dagraca

    Joined:
    Jun 28, 2016
    Posts:
    11
    Hello
    I ve installed the new version : UIWidgets.1.10.0b15-Unity2018.2.4 (i m on 2018.2.12f)

    Create a new project
    Add UIWidgets
    try to compile for windows
    you ll get an error message (see picture)

    how can i fix that please ?

    upload_2018-10-17_15-8-32.png
     
  50. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    578
    Open UIWidgets/Scripts/Style/IStyleDefaultValues.cs and replace SetDefaultValues() definifion with following code
    Code (CSharp):
    1. #if UNITY_EDITOR
    2.         /// <summary>
    3.         /// Sets the default values.
    4.         /// </summary>
    5.         void SetDefaultValues();
    6. #endif