Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

New UI Widgets

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

  1. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,266
    Hi @ilih
    Any idea what could be issue of this "jurky" animation if we show a lot of notifications using contentsize fitter height and animations

    instance.Show("Notification with buttons. Hide after 3 seconds.", customHideDelay: 5f, showAnimation:Notify.ShowAnimationSlideDown, hideAnimation:Notify.AnimationSlideUp);

    Please advise
     
  2. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    905
    Can you a video of how the problem animation looks?
     
    jGate99 likes this.
  3. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,266
    As forum doesnt allow uploading of mp4, so here it is
    https://we.tl/t-s7XiS1NrTl
     
  4. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    905
    It's some strange problem with partial layout updates.

    Fix:
    Replace
    UpdateLayout()
    method in EasyLayout.cs
    Code (CSharp):
    1.         public void UpdateLayout()
    2.         {
    3.             LayoutRebuilder.ForceRebuildLayoutImmediate(rectTransform);
    4.         }
     
    jGate99 likes this.
  5. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,266
    Hi @ilih
    I noticed a problem with ListView Default Item's Image.
    If i apply "simple" image (rather than sliced) , list item height become quite huge rather than variable height.
    Please check the issue
     
  6. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    905
    Gameobject layout size is calculated using layout sizes provided by its components.
    So if you have an Image component and Layout Group component, then each layout property value is maximum from property value from those components.
    How calculated Image layout preferred size:
    • sliced type: width = left border + right border; height = top border + bottom border
    • simple type: width = sprite width; height = sprite height
    So you should use either sliced or tiled image type or use sprite with less height.

    You can check Layout properties and what component provides them at bottom of the inspector window.
    upload_2021-3-10_14-49-31.png
     
    jGate99 likes this.
  7. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    905
    Another way to solve this is to remove the Image component from DefaultItem, create nested gameobject to DefaultItem, add Image and LayoutElement with enabled IgnoreLayout option, then stretch RectTransform to fill.
     
    jGate99 likes this.
  8. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,266
    Thanks for detailed answer, i believe its simple to stick with first option as its easier.
     
  9. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,266
    Hi @ilih
    GroupListView example seems difficuilt to understand, so can you please explain in high level points how to create one?
    Thanks
     
  10. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    905
    Here is a more simple example of the GroupedListView:
    1. Data class should have some flag to distinguish a group item from an ordinary item.
      Here used IsGroup field.
      Code (CSharp):
      1.     public class SimpleGroupedItem
      2.     {
      3.         public string Name;
      4.  
      5.         public bool IsGroup;
      6.     }
    2. Generate widgets for this data type.
    3. Create a GroupedList. You need to create a method to determine group by ordinary item.
      Code (CSharp):
      1.     public class SimpleGroupedList : GroupedList<SimpleGroupedItem>
      2.     {
      3.         protected override SimpleGroupedItem GetGroup(SimpleGroupedItem item)
      4.         {
      5.             // determine a unique group feature; here used the first letter of the name
      6.             var name = item.Name.Length > 0 ? item.Name[0].ToString() : string.Empty;
      7.  
      8.             // first check is such group already exists
      9.             foreach (var key in GroupsWithItems.Keys)
      10.             {
      11.                 if (key.Name == name)
      12.                 {
      13.                     return key;
      14.                 }
      15.             }
      16.  
      17.             // if the group does not exists create a new item and mark it as the group item
      18.             return new SimpleGroupedItem()
      19.             {
      20.                 Name = name,
      21.                 IsGroup = true,
      22.             };
      23.         }
      24.     }
    4. Now add the GroupedData field to the ListView.
      Code (CSharp):
      1.     public class SimpleGroupedListView : ListViewCustom<SimpleGroupedComponent, SimpleGroupedItem>
      2.     {
      3.         // GroupedData will used instead of DataSource
      4.         public SimpleGroupedList GroupedData = new SimpleGroupedList();
      5.  
      6.         bool isGroupedListViewInited;
      7.  
      8.         public override void Init()
      9.         {
      10.             if (isGroupedListViewInited)
      11.             {
      12.                 return;
      13.             }
      14.  
      15.             isGroupedListViewInited = true;
      16.  
      17.             base.Init();
      18.  
      19.             // set groups sort by name
      20.             GroupedData.GroupComparison = (x, y) => UtilitiesCompare.Compare(x.Name, y.Name);
      21.             // set data source
      22.             GroupedData.Data = DataSource;
      23.  
      24.             // allow select only ordinary items, not the group items
      25.             CanSelect = IsItem;
      26.         }
      27.  
      28.         bool IsItem(int index)
      29.         {
      30.             return !DataSource[index].IsGroup;
      31.         }
      32.     }
    5. At this point, GroupedListView can be used, but there is no visual difference between group items and ordinary items. To fix it you need to change the DefaultItem component class:
      Code (CSharp):
      1.     public class SimpleGroupedComponent : ListViewItem, IViewData<SimpleGroupedItem>
      2. {
      3.         // .... skipped code
      4.  
      5.         public virtual void SetData(SimpleGroupedItem item)
      6.         {
      7.             Item = item;
      8.             Name.text = item.Name;
      9.  
      10.             if (item.IsGroup)
      11.             {
      12.                 Name.fontSize = 20;
      13.                 Name.fontStyle = FontStyle.Bold;
      14.                 Name.alignment = TextAnchor.MiddleCenter;
      15.             }
      16.             else
      17.             {
      18.                 Name.fontSize = 14;
      19.                 Name.fontStyle = FontStyle.Normal;
      20.                 Name.alignment = TextAnchor.MiddleLeft;
      21.             }
      22.         }
     
  11. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    905
    version 1.14.0 released




    Changelog:
    • added localizations integration support
    • added I2 Localization support
    • added ContextMenu
    • added Input System support
    • added UtilitiesCompare class
    • added ScrollRectFooter
    • added AutoComboboxIcons prefab
    • Dialog, Picker, Popup: added CloseButton property
    • EasyLayout: added SetPreferredAndFitContainer option for the Children Size
    • ListView: added Header property
    • ListViewPaginator: added LoopedList support
    • Notification: added “content” and “onReturn” parameters to the Show() method
    • Style: fixed unchangeable settings after “Apply Fast Settings” use
    • Style: added “Update Default Style” option, which is opposite of the “Apply Default Style”, it gets style settings from widgets and saves them to the current style
    • Tabs: added CanSelectTab field to check if tab can be selected with a button click.
    • TabsCustom: TabButton class changed to the generic class TabButton<T>
    • Widgets Generation: generated classes are partial now
    • Widgets Generation: added AutoCombobox widget
    • Utilities: most functions moved to the new Utilities* classes
     
    hopeful likes this.
  12. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    905
    v1.14.1 released

    Changelog:
    • EasyLayout: reduced memory allocations
    • Widgets Generation: fixed type name error
    • Widgets Generation: fixed missing reference
     
    jGate99 likes this.
  13. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,266
  14. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    905
    jGate99 likes this.
  15. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,266
  16. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    905
    jGate99 likes this.
  17. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,266
    Few questions:


    1- Is tree graph virtualized?

    2- I noticed tree graph is using digonal lines and I need to show it more like green lines this ?

    Capture.PNG
     
  18. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    905
    No virtualization because all nodes displayed (there is no scrollable area to have hidden nodes), but gameobjects pool is used.

    I have plans to add lines with right angles.
     
    jGate99 likes this.
  19. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,266
  20. kayy

    kayy

    Joined:
    Jul 26, 2011
    Posts:
    86
    Any chance to get access to TextAdapter FontStyle? During upgrade to the most recent version code like text.fontStyle = FontStyle.Bold is obsolete
    Thanks
     
  21. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    905
    I'll add it in the next update.
    The problem is Unity FontStyle and TMPro FontStyle are not really compatible,
     
    kayy likes this.
  22. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,266
    Hi @ilih,
    Can you please provide a sample for a horizontal list like that?
    Capture.PNG
     
unityunity