Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

New UI Widgets

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

  1. Christoph_CH

    Christoph_CH

    Joined:
    Jun 26, 2015
    Posts:
    14
    Hello Ilih
    nice new functions in your update !!
    I have a small problem with Accordion : When I disable the Animate-function (in case of big items, it takes too long for me) I can only open the items once ?! When I then in Run-Mode active Animate function in Editor again, I have to click twice and everything is fine again ?!
    I tested also with old version; same problem there...

    Thanks and best regards
    Christoph
     
  2. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    707
    Fix:
    Replace lines 166-167 in Accordion/Accordion.cs
    old code:
    Code (CSharp):
    1.                 item.ContentObject.SetActive(false);
    2.                 OnToggleItem.Invoke(item);
    new code

    Code (CSharp):
    1.                 item.ContentObject.SetActive(false);
    2.                 item.Open = false;
    3.                 OnToggleItem.Invoke(item);
     
  3. Christoph_CH

    Christoph_CH

    Joined:
    Jun 26, 2015
    Posts:
    14
    Thanks, Accordion works fine (-:

    Now I try to make a file open Dialog template, with TreeView and ListView

    I duplicate working Dialog template
    I add TreeView in Dialog Content area
    I try to add ListView via Menu, that doesn't work for some reason (adding as ListView-Prefab works fine) !!??
    I create a new instance of DialogHelper Class
    In Refresh-method I add routines from documentation :

    Code (CSharp):
    1.     public void Refresh(string path) {
    2.  
    3.         if (!_InitDone)
    4.         {
    5.             var config = new List<int>() { 5, 5, 2 };
    6.             nodes = GenerateTreeNodes(config, isExpanded: true);
    7.  
    8.             // Set nodes
    9.             Folders.Start();
    10.             Folders.Nodes = nodes;
    11.  
    12.             _InitDone = true;
    13.         }
    14.     }
    15.  

    Press run, and select button for open the Dialog
    I see the dialog and treeview with entries and then get following 2 errors :

    Any idea ??

    Thanks
    Christoph

    ArgumentOutOfRangeException: Argument is out of range.
    Parameter name: index
    System.Collections.Generic.List`1[UIWidgets.TreeViewComponent].CheckRange (Int32 idx, Int32 count) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:106)
    System.Collections.Generic.List`1[UIWidgets.TreeViewComponent].GetRange (Int32 index, Int32 count) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:371)
    UIWidgets.ListViewCustom`2[TComponent,TItem].UpdateComponentsCount () (at Assets/UIWidgets/Standart Assets/ListView/ListViewCustom.cs:848)
    UIWidgets.ListViewCustom`2[TComponent,TItem].UpdateView () (at Assets/UIWidgets/Standart Assets/ListView/ListViewCustom.cs:1033)
    UIWidgets.ListViewCustom`2[TComponent,TItem].Resize () (at Assets/UIWidgets/Standart Assets/ListView/ListViewCustom.cs:516)
    UnityEngine.Events.InvokableCall.Invoke (System.Object[] args) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:149)
    UnityEngine.Events.InvokableCallList.Invoke (System.Object[] parameters) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:626)
    UnityEngine.Events.UnityEventBase.Invoke (System.Object[] parameters) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:766)
    UnityEngine.Events.UnityEvent.Invoke () (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_0.cs:54)
    UIWidgets.ResizeListener.OnRectTransformDimensionsChange () (at Assets/UIWidgets/Standart Assets/Utilites/ResizeListener.cs:46)
    UnityEngine.UI.ScrollRect:LateUpdate()



    Trying to remove Toggle (UnityEngine.UI.Image) from rebuild list while we are already inside a rebuild loop. This is not supported.
    UnityEngine.GameObject:SetActive(Boolean)
    UIWidgets.TreeViewComponentBase`1:SetData(TreeNode`1, Int32) (at Assets/UIWidgets/Standart Assets/TreeView/TreeViewComponentBase.cs:141)
    UIWidgets.TreeViewComponent:SetData(TreeNode`1, Int32) (at Assets/UIWidgets/Standart Assets/TreeView/TreeViewComponent.cs:40)
    UIWidgets.TreeView:SetData(TreeViewComponent, ListNode`1) (at Assets/UIWidgets/Standart Assets/TreeView/TreeView.cs:17)
    UIWidgets.<UpdateView>c__AnonStorey28:<>m__15(TreeViewComponent, Int32) (at Assets/UIWidgets/Standart Assets/ListView/ListViewCustom.cs:1051)
    UIWidgets.ForEachExtensions:ForEach(IEnumerable`1, Action`2) (at Assets/UIWidgets/Standart Assets/Utilites/Utilites.cs:181)
    UIWidgets.ListViewCustom`2:UpdateView() (at Assets/UIWidgets/Standart Assets/ListView/ListViewCustom.cs:1049)
    UIWidgets.ListViewCustom`2:Resize() (at Assets/UIWidgets/Standart Assets/ListView/ListViewCustom.cs:516)
    UnityEngine.Events.UnityEvent:Invoke()
    UIWidgets.ResizeListener:OnRectTransformDimensionsChange() (at Assets/UIWidgets/Standart Assets/Utilites/ResizeListener.cs:46)
    UnityEngine.UI.ScrollRect:LateUpdate()
     
  4. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    707
    In some cases height or width can be negative and it's cause first error.
    Replace CalculateMaxVisibleItems method in ListViewCustom.cs
    Code (CSharp):
    1.         protected virtual void CalculateMaxVisibleItems()
    2.         {
    3.             if (IsHorizontal())
    4.             {
    5.                 maxVisibleItems = (int)Math.Ceiling(scrollWidth / itemWidth);
    6.             }
    7.             else
    8.             {
    9.                 maxVisibleItems = (int)Math.Ceiling(scrollHeight / itemHeight);
    10.             }
    11.             maxVisibleItems = Math.Max(maxVisibleItems, 1) + 1;
    12.         }
    For another error:
    • Add following code in ListViewCustom.cs
      Code (CSharp):
      1.         bool needResize;
      2.         void SetNeedResize()
      3.         {
      4.             needResize = true;
      5.         }
    • Replace Update method
      Code (CSharp):
      1.         void Update()
      2.         {
      3.             if (needResize)
      4.             {
      5.                 Resize();
      6.             }
      7.  
      8.             if (IsEndScrolling())
      9.             {
      10.                 EndScrolling();
      11.             }
      12.         }
    • Replace line 453
      Code (CSharp):
      1.                 r.OnResize.AddListener(SetNeedResize);
     
  5. alizdesk

    alizdesk

    Joined:
    Mar 26, 2015
    Posts:
    46
    Sample scene raises following errors whenever i try to play with Lists View
     

    Attached Files:

  6. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    707
    Unity 5.2?
    Delete gameobject Canvas / NotifyContainer / NotifyTemplateBlack.
    Duplicate Canvas / NotifyContainer / NotifyTemplateAutoHide and rename duplicate to NotifyTemplateBlack.

    If error remains tell me which Unity version you use.
     
    Last edited: Oct 1, 2015
  7. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    707
    I forgot to add labels to some prefabs after updating them. They should have label like "Uiwidgets<Prefab name>Prefab".
     
  8. GXMark

    GXMark

    Joined:
    Oct 13, 2012
    Posts:
    402
    I been having problems with the TreeView Component in that when scrolling the nodes are getting corrupted at the top and bottom of the viewport (mask). Have sent some screen shots to Ilya for investigation.

    The problem occurs both on the demo scene and my custom tree view.

    Update : In Editor Mode : Seems when the screen resolution is updated which forces a redraw the problem goes away. Any ideas?

    Update: The problem does not appear in Build mode only in Editor mode.
     
    Last edited: Oct 2, 2015
  9. RazaTech

    RazaTech

    Joined:
    Feb 27, 2015
    Posts:
    169
  10. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    707
    You can use separate script for it.
    Code (CSharp):
    1. using UnityEngine;
    2. using UIWidgets;
    3.  
    4. public class ScrollbarToggle : MonoBehaviour {
    5.     public ListViewIcons ListView;
    6.  
    7.     void Start()
    8.     {
    9.         Hide();
    10.  
    11.         ListView.OnStartScrolling.AddListener(Show);
    12.         ListView.OnEndScrolling.AddListener(Hide);
    13.     }
    14.  
    15.     void Show()
    16.     {
    17.         ListView.ScrollRect.verticalScrollbar.gameObject.SetActive(true);
    18.     }
    19.  
    20.     void Hide()
    21.     {
    22.         ListView.ScrollRect.verticalScrollbar.gameObject.SetActive(false);
    23.     }
    24.  
    25.     void OnDestroy()
    26.     {
    27.         ListView.OnStartScrolling.RemoveListener(Show);
    28.         ListView.OnEndScrolling.RemoveListener(Hide);
    29.     }
    30. }
     
    RazaTech likes this.
  11. alizdesk

    alizdesk

    Joined:
    Mar 26, 2015
    Posts:
    46
    I'm using Unity 5.2
    I get this error when i scroll really fast
     

    Attached Files:

  12. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    707
    Problem happen when ScrollRect Movement Type set to Unresticted or Elastic.

    Here is fix:
    Replace line 740 in ListView.cs and line 681 in ListViewCustom.cs
    Old line:
    Code (CSharp):
    1.             return (IsHorizontal()) ? -pos.x : pos.y;
    New line:
    Code (CSharp):
    1.             return Mathf.Max(0f, (IsHorizontal()) ? -pos.x : pos.y);
    But I am not successed to reproduce problem with "Trying to remove ... from rebuild list ...". If it still occurs after fix I need exact Unity version and full error message.
     
  13. Christoph_CH

    Christoph_CH

    Joined:
    Jun 26, 2015
    Posts:
    14
    Sorry, but I have no idea whatyou mean what I should do ?!
     
  14. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    707
    Select prefab in Project window, in bottom right corner you can add labels to prefab.
    For ListView you should add label "UiwidgetsListViewPrefab", for ListViewIcons label "UiwidgetsListViewIconsPrefab", without such label creating widget from menu not working.
    Now 4 prefabs without labels Combobox, ComboboxIcons, ListView, ListViewIcons.
     
  15. Christoph_CH

    Christoph_CH

    Joined:
    Jun 26, 2015
    Posts:
    14
    Ahhh :)
    Now I understand and it works !!

    Thanks again for very quick response

    Christoph
     
  16. Germanus4711

    Germanus4711

    Joined:
    Nov 20, 2012
    Posts:
    7
    I am using 5.2.1f1 and I found that the Combobox is not showing the input field caret.
    This seems to be a reported bug: http://forum.unity3d.com/threads/5-...-even-in-the-default-one.353817/#post-2287840

    I tried the suggested "dirty patch", in Combobox.cs, I changed the following:
    Line 1: add "using System; // added for Exception"

    Around the line 137 look for:
    input.onEndEdit.AddListener(InputItem);

    Below that add the following:
    try {
    Transform caretGO = input.transform.FindChild(input.transform.name + " Input Caret");
    caretGO.GetComponent<CanvasRenderer>().SetMaterial(Graphic.defaultGraphicMaterial, Texture2D.whiteTexture);​
    } catch (Exception e) {
    // dirty fix for missing caret​
    }

    Question: Am I adding the fix in the right place?

    PS: forgot to mention that that actually fixes the input field problem in the combobox :)
     
  17. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    707
    Yes.
    But I think it's better to add script from linked post to gameobject with InputField than making changes in Combobox.cs - changes will disappear with package update.
     
    Germanus4711 likes this.
  18. Christoph_CH

    Christoph_CH

    Joined:
    Jun 26, 2015
    Posts:
    14
    Hello Ilih

    I have another issue with ListView component ("Multiple" is not activated).
    I filled the listview with folder names; as soon the user clicks on one item, I want to create a file list in another ListView.
    I use the OnClick-Event of the Default item; Inside Function call I use "SelectedItem", to find out which foldername has been selected...

    Unfortunatly I didn't get the new selected folder element; I get the last selection ?!

    What is my mistake ??

    Thanks, Christoph
     
  19. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    707
    OnClick event of DefaultItem raised before SelectedItem updated.

    You need to make few changes to make ListView.OnSelectString and ListViewIcons.OnSelectObject available in inspector and use this event instead DefaultItem.OnClick.
    1. Add [Serializable] attribute to ListViewEvent class in line 29 in ListView.cs
    2. Add [Serializable] attribute to ListViewCustomEvent class in line 23 in ListViewCustom.cs
    3. In Editor/ListViewEditor.cs add code after line 38:
      Code (CSharp):
      1. "OnSelectString",
      And add code after line 84
      Code (CSharp):
      1. EditorGUILayout.PropertyField(serializedProperties["OnSelectString"]);
    4. In Editor/ListViewCustomEditor.cs add code after line 30:
      Code (CSharp):
      1. "OnSelectObject",
    After it OnSelectObject and OnSelectString events will be available in inspector window. Use this event to create a file list in another ListView.
     
    Last edited: Oct 13, 2015
  20. Christoph_CH

    Christoph_CH

    Joined:
    Jun 26, 2015
    Posts:
    14
    :DThanks

    Getting better and better !!
     
  21. alizdesk

    alizdesk

    Joined:
    Mar 26, 2015
    Posts:
    46
    Hi, i created a variable height list with TextMesh in the label and it worked well. However on device performance is quite terrible. please advise
     
  22. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    707
    By TextMesh you mean this component?

    You should try Unity 5.2, in this version UI performance was improved.
     
  23. alizdesk

    alizdesk

    Joined:
    Mar 26, 2015
    Posts:
    46
    Sorry, i was referring to TextMesh Pro and Scrolling Performance.
    I'm already using 5.2.1
     
  24. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    707
    Please check where time spended in Profiler with "Deep Profile" enabled.
    Try to update to latest version TextMesh Pro.
    What about performance wth Unity Text component?
     
  25. alizdesk

    alizdesk

    Joined:
    Mar 26, 2015
    Posts:
    46
    Only problem i faced with TextMeshPro was bad scrolling performance.
    But when i switched to Unity 5.2 Text, List now only renders 1-2 items and remaining area is just empty. However when i scroll those 2 items get replaced with new items.

    [EDIT]
    Anyhow, thats not an issue.
    I want to go with TextMeshPro due to its RICH TEXT capabilities. I'm working on a complex application that require HTML based Styling. Can you please investigate TextMesh Pro integration?


    [EDIT 2]
    Ok scrolling works fine if i scroll it with vertical scrollbar on right with TextMeshPro. Which means scrolling itself is working fine along with TextMeshPro.
    However when i scroll without vertical scrollbar (over list items which is what everyone does on a mobile/tablet device) scrolling suffers.

    Please take a look.
    Thanks
     

    Attached Files:

    Last edited: Oct 18, 2015
  26. Zarif73

    Zarif73

    Joined:
    Aug 30, 2012
    Posts:
    5
    Hi ilih,
    I'm working with Unity 5.1.2 on Mac.
    I have some issue with handles of RangeSlider under Canvas (Screen Space - Camera),
    they just get some strange transform.
    With Canvas in Overlay mode I don't have that issue.
    Can you check it?
    Thanks
     
  27. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    707
    Try to add Canvas in Viewport and move List inside Canvas.
    Setting for Canvas: Anchors = Top Stretch, Pivot.y = 1, ContentSizeFitter.VerticalFit = Preferred Size


    You should check how TextMeshPro work with ScrollRect only - create ScrollView, add gameobjects with TextMeshPro inside Content and check performance on scrolling.
     
  28. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    707
    Fix:
    RangeSliderBase.cs
    • Replace GetStartPoint()
      Code (CSharp):
      1.         protected float GetStartPoint()
      2.         {
      3.             var pos = UsableRangeRect.anchoredPosition;
      4.            
      5.             var pivot = (IsHorizontal()) ? HandleMinRect.pivot.x : HandleMinRect.pivot.y;
      6.             var rect = HandleMinRect.rect;
      7.             var size = (IsHorizontal()) ? rect.width : rect.height;
      8.            
      9.             var result = ((IsHorizontal()) ? pos.x : pos.y) + (size * (pivot + 0.25f));
      10.  
      11.             return result;
      12.         }
    • Replace UpdateFill()
      Code (CSharp):
      1.         void UpdateFill()
      2.         {
      3.             if (IsHorizontal())
      4.             {
      5.                 FillRect.anchoredPosition = new Vector2(HandleMinRect.anchoredPosition.x, FillRect.anchoredPosition.y);
      6.                 var sizeDelta = new Vector2((HandleMaxRect.anchoredPosition.x - HandleMinRect.anchoredPosition.x), FillRect.sizeDelta.y);
      7.                 FillRect.sizeDelta = sizeDelta;
      8.             }
      9.             else
      10.             {
      11.                 FillRect.anchoredPosition = new Vector2(FillRect.anchoredPosition.x, HandleMinRect.anchoredPosition.y);
      12.                 var sizeDelta = new Vector2(FillRect.sizeDelta.x, (HandleMaxRect.anchoredPosition.y - HandleMinRect.anchoredPosition.y));
      13.                 FillRect.sizeDelta = sizeDelta;
      14.             }
      15.         }
    • In UpdateHandle() replace handleTransform.position on handleTransform.anchoredPosition
    • In OnPointerClick() replace
      Code (CSharp):
      1.             var min_position = IsHorizontal() ? HandleMinRect.position.x : HandleMinRect.position.y;
      2.             var max_position = IsHorizontal() ? HandleMaxRect.position.x : HandleMaxRect.position.y;
      on
      Code (CSharp):
      1.             var min_position = IsHorizontal() ? HandleMinRect.anchoredPosition.x : HandleMinRect.anchoredPosition.y;
      2.             var max_position = IsHorizontal() ? HandleMaxRect.anchoredPosition.x : HandleMaxRect.anchoredPosition.y;
    RangeSliderHandle.cs
    • In OnDrag() remove line:
      Code (CSharp):
      1. curCursor -= RectTransform.rect.position;
    • In OnDrag() and IsNewPosition() replace RectTransform.position on RectTransform.anchoredPosition
    CenteredSliderBase.cs
    • Replace GetStartPoint()
      Code (CSharp):
      1.         protected float GetStartPoint()
      2.         {
      3.             var pos = UsableRangeRect.anchoredPosition;
      4.  
      5.             var pivot = (IsHorizontal()) ? HandleRect.pivot.x : HandleRect.pivot.y;
      6.             var rect = HandleRect.rect;
      7.             var size = (IsHorizontal()) ? rect.width : rect.height;
      8.  
      9.             var result = ((IsHorizontal()) ? pos.x : pos.y) + (size * (pivot + 0.25f));
      10.  
      11.             return result;
      12.         }
    • In UpdateHandle() replace handleTransform.position on handleTransform.anchoredPosition
     
  29. alizdesk

    alizdesk

    Joined:
    Mar 26, 2015
    Posts:
    46
    @ilih,
    TextMeshPro is working fine just like Unity's Own Text.
    So now only problem remaining is with scrolling on Android.
    For example, if i scroll with scrollbars it scroll fine (really fast)
    However when i try to scroll over items (yellow area) it s slow and jerky .
    I can send apk for test.
     

    Attached Files:

  30. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    707
    Please send apk with "Development build" enabled to in@ilih.ru
     
  31. RazaTech

    RazaTech

    Joined:
    Feb 27, 2015
    Posts:
    169
    what if i have to use horizont list what about horizontal list optimization (virtual layout)
     
  32. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    707
    Optimization work with any direction, it requires only EasyLayout in Container gameobject.
     
  33. Zarif73

    Zarif73

    Joined:
    Aug 30, 2012
    Posts:
    5
    Hi ilih,
    Thanks :)
     
  34. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    707
    Is Canvas Pixel Perfect enabled? Try to disable it.
     
  35. Zarif73

    Zarif73

    Joined:
    Aug 30, 2012
    Posts:
    5
    Hi again,
    Now I'm trying to add some text labels under the slider,
    but I'm experiencing a strange issue, the length between the numbers is not equal,
    and the right handle is not matching the labels.
    Screen Shot 2015-10-19 at 2.16.58 PM.png


    Screen Shot 2015-10-19 at 2.17.31 PM.png


    Screen Shot 2015-10-19 at 2.18.29 PM.png

    Can you check it?
    Thanks,
     
  36. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    707
    Fix:
    RangeSliderBase.cs
    • Replace FillSize()
      Code (CSharp):
      1.         protected float FillSize()
      2.         {
      3.             return (IsHorizontal()) ? UsableRangeRect.rect.width : UsableRangeRect.rect.height;
      4.         }
    • Replace GetStartPoint()
      Code (CSharp):
      1.         protected float GetStartPoint()
      2.         {
      3.             return IsHorizontal() ? -UsableRangeRect.sizeDelta.x / 2f : -UsableRangeRect.sizeDelta.y / 2f;
      4.         }
    • Replace UpdateHandle()
      Code (CSharp):
      1.         protected void UpdateHandle(RectTransform handleTransform, T value)
      2.         {
      3.             var new_position = handleTransform.anchoredPosition;
      4.             if (IsHorizontal())
      5.             {
      6.                 new_position.x = ValueToPosition(value) + handleTransform.rect.width * (handleTransform.pivot.x - 0.5f);
      7.             }
      8.             else
      9.             {
      10.                 new_position.y = ValueToPosition(value) + handleTransform.rect.height * (handleTransform.pivot.y - 0.5f);
      11.             }
      12.             handleTransform.anchoredPosition = new_position;
      13.         }
     
  37. Zarif73

    Zarif73

    Joined:
    Aug 30, 2012
    Posts:
    5
    Thanks again :D
     
  38. alizdesk

    alizdesk

    Joined:
    Mar 26, 2015
    Posts:
    46
    Canvas is not pixel perfect.
    Scrolling works fine when using scrollbars, but not when touching over items. Maybe item events are creating conflict?
     

    Attached Files:

  39. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    707
    Performance drop after changing text from code in ListViewVariableHeightComponent.cs.
    Code (CSharp):
    1.             Name.text = item.Name;
    2.             Text.text = item.Text.Replace("\\n", "\n");
    But for now I don't understand why it happening.

    Upd.
    But this code don't cause performance drop. Looks like problem with pointers.
    Code (CSharp):
    1.             Name.text = "some name";
    2.             Text.text = "some text";
    Upd.2
    Performance drop caused by empty string. But now I can see performance drop on scrolling.
    Code (CSharp):
    1.             Text.text = "";
     
    Last edited: Oct 19, 2015
  40. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    707
    TextMeshPro make too many unnesesary GenerateTextMesh() calls, add following code in TextMeshProUGUI.cs at start of CalculateLayoutInputHorizontal() and CalculateLayoutInputVertical()
    Code (CSharp):
    1.             var need_rebuild = m_isCalculateSizeRequired || isInputParsingRequired;
    2.             if (!need_rebuild)
    3.             {
    4.                 return ;
    5.             }
    And replace lines 983-987 in ListViewCustom.cs
    Code (CSharp):
    1.                 components.ForEach((x, i) => {
    2.                     if (indicies.Contains(x.Index))
    3.                     {
    4.                         return ;
    5.                     }
    6.                     x.Index = indicies[i];
    7.                     SetData(x, customItems[indicies[i]]);
    8.                     Coloring(x as ListViewItem);
    9.                 });
    10.                 components.OrderBy(x => x.Index).ForEach(x => x.transform.SetAsLastSibling());
     
  41. Tinjaw

    Tinjaw

    Joined:
    Jan 9, 2014
    Posts:
    518
    It would be wonderful if you could pass that optimization on to the TextMesh Pro developer.
     
  42. alizdesk

    alizdesk

    Joined:
    Mar 26, 2015
    Posts:
    46
    Yes, that'd be great, im also going to let him know about this suggestion
     
  43. Germanus4711

    Germanus4711

    Joined:
    Nov 20, 2012
    Posts:
    7
    I am having a little trouble using the ListViewGameObjects.

    I try to put together a todo list, meaning a Toggle and a string. Both are in a prefab named ToDoPrefab.
    In my script I have public ListViewGameObjects listView; and public GameObject listItem;
    listView is the ListViewGameObjects Prefab and listItem the ToDoPrefab.

    Then I did:
    for (int i = 0; i < 4; i++) {
    GameObject litemp = Instantiate(listItem);
    litemp.SetActive(true);
    listView.Add(litemp);​
    }

    Works quite well, but the ToDoPrefab objects are cluttered together (Spacing of the layout group is used).
    RectTransform rt = (RectTransform) listItem.transform;
    float _h = rt.rect.height;
    Does show the correct height.

    Also how do I do the select item highlight, like in the regular ListView?

    Any ideas what I am missing?

    Thanks for any hints :)
     
  44. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    707
    May be some incorrect settings in List gameobject or ToDoPrefab. Inspector window screenshots of List gameobject or ToDoPrefab will be helpful.

    Using ListViewGameObjects events to change colors OnPointerEnterObject, OnPointerExitObject, OnSelectObject, OnDeselectObject.

    ListViewGameObjects designed for using it with not unified objects. For todolist better use special listview derived from ListViewCustomHeight. See sample in attachment.
     

    Attached Files:

  45. alizdesk

    alizdesk

    Joined:
    Mar 26, 2015
    Posts:
    46

    Attached Files:

    Last edited: Oct 21, 2015
  46. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    707
    Not possible in current version, but will work in next version with Children Width = Fit Container and LayoutElement with Flexible Width in first child and Minimal Width on others.

    No, next version is almost finished. About future versions I don't know.
     
  47. alizdesk

    alizdesk

    Joined:
    Mar 26, 2015
    Posts:
    46
    Please consider it for future version.
    Its a small component, but will help a lot in responsive apps.
     
  48. Germanus4711

    Germanus4711

    Joined:
    Nov 20, 2012
    Posts:
    7
    Thanks for the nice example, testing it now.
     
  49. alizdesk

    alizdesk

    Joined:
    Mar 26, 2015
    Posts:
    46
  50. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    707
    It's take a time to write project which demonstrate problem with scrolling.