Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. 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,060
    wow, Thanks :)
     
  2. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,060
    @ilih
    Changing List' spacing X and Y to 20, 20 mess up layout on last page in TileViewIcons.
    It works great with default values 5,5 but mess up layout on last page if value is changed.
    Please advise
     
  3. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    810
    I suppose you change settings in runtime, then after changing layout Spacing (or any other settings) you should call TileView.UpdateItems() and if you use ScrollRectPaginator also set ScrollRectPaginator.PageSpacing = 20
     
    Last edited: Jul 21, 2016
  4. MegaFlash

    MegaFlash

    Joined:
    Dec 29, 2014
    Posts:
    18
    Hi,
    Been using your asset and it works great, was wondering if they was a way for me to do a range of colours in a color palette. What I want to do is for my character to be able to only choose from Black (to full black) to almost white, but not allow some hard green or purple etc in their color palette.

    Keep the good works.

    Thanks
     
  5. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    810
    ColorPickerRange added in 1.8.4beta1
    By default it's horizontal, for vertical change slider direction and replace ColorPickerRange default shader with UIGradientShaderVLineRGB.
     
  6. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    810
    Version 1.8.3 released

    Changelog:
    • Added SelectableHelper - allow to control additional Graphic component according selection state of current gameobject. So you can control button background color with Button component and Button text color with SelectableHelper
    • Added ListViewInt
    • Added Picker - base class for creating own pickers
    • Added PickerInt, PickerString, PickerIcons
    • Added LayoutSwitcher
    • SpinnerFloat - added property Culture, specified how number will be displayed and how input will be parsed
    • SpinnerFloat - added field DecimalSeparators, along with decimal separator within Culture determine valid decimal separators for input
      (Warning: incompatible types with different Unity versions - Unity 4.x use string[] and Unity 5.x use char[])
    • Spinner, SpinnerFloat - fixed overflow exception
    • Resizable - added corners directions for resize
    • ListView's - added FadeDuration for colors change
     
    Last edited: Jul 23, 2016
    jGate99 likes this.
  7. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,060
    Both List's easy Layout spacing and Paginator's Page Spacing has to be same to prevent last page layout mess up. So my suggestion is to hide Paginator's Spacing and Paginator get that value from List's EasyLayout so user dont have to make same change in 2 places.
     
  8. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    810
    ScrollRectPaginator works with ScrollRect and does not know anything about layout - if any layout used and what type of layout used, and how to get spacing from it.
    I'll think how to solve this.
     
  9. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,060
    New UI Widgets in on Sale,
    Its great time to buy it, you wont regret it.
    A Happy Customer
     
  10. Jalrashu

    Jalrashu

    Joined:
    May 29, 2013
    Posts:
    1
    Unity 5.3.5f1

    Tried on a brand new project.

    ComboBoxIcons seem to be getting stuck after an item is selected (won't allow you to select anything anymore).. All the combo box items are highlighted in white when first opened as well.
     
  11. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    810
    Fix:
    Replace OnEnable in ListViewCustom.cs with following code
    Code (CSharp):
    1.         public virtual void OnEnable()
    2.         {
    3.             StartCoroutine(ForceRebuild());
    4.  
    5.             var old = FadeDuration;
    6.             FadeDuration = 0f;
    7.             components.ForEach(Coloring);
    8.             FadeDuration = old;
    9.         }
    And uncomment line 300 in ComboboxCustom.cs
    Code (CSharp):
    1. listView.transform.SetParent(listParent);
    Or you can download updated version.
     
  12. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,060

    I added DragRedirect but there is no smoothness and elasticity. Secondly if you start dragging and then leave in middle, page stuck there, instead of moving back
    Please advise
     
  13. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    810
    Found mistake, previous version redirect drag events only to ScrollRect instead all components in ScrollRect gameobject.
    Here is fixed version:
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.EventSystems;
    3. using System;
    4.  
    5. namespace UIWidgets {
    6.     /// <summary>
    7.     /// Redirect drag events from current gameobject to specified.
    8.     /// </summary>
    9.     public class DragRedirect : UIBehaviour, IBeginDragHandler, IInitializePotentialDragHandler, IDragHandler, IEndDragHandler, IScrollHandler
    10.     {
    11.         [SerializeField]
    12.         public GameObject RedirectTo;
    13.  
    14.         protected T[] GetHandlers<T>() where T : class
    15.         {
    16.             #if UNITY_4_6 || UNITY_4_7
    17.             return Array.ConvertAll(RedirectTo.GetComponents(typeof(T)), x => (x as T));
    18.             #else
    19.             return RedirectTo.GetComponents<T>();
    20.             #endif
    21.         }
    22.  
    23.         public void OnBeginDrag(PointerEventData eventData)
    24.         {
    25.             foreach (var handler in GetHandlers<IBeginDragHandler>())
    26.             {
    27.                 handler.OnBeginDrag(eventData);
    28.             }
    29.         }
    30.  
    31.         public void OnInitializePotentialDrag(PointerEventData eventData)
    32.         {
    33.             foreach (var handler in GetHandlers<IInitializePotentialDragHandler>())
    34.             {
    35.                 handler.OnInitializePotentialDrag(eventData);
    36.             }
    37.         }
    38.  
    39.         public void OnDrag(PointerEventData eventData)
    40.         {
    41.             foreach (var handler in GetHandlers<IDragHandler>())
    42.             {
    43.                 handler.OnDrag(eventData);
    44.             }
    45.         }
    46.  
    47.         public void OnEndDrag(PointerEventData eventData)
    48.         {
    49.             foreach (var handler in GetHandlers<IEndDragHandler>())
    50.             {
    51.                 handler.OnEndDrag(eventData);
    52.             }
    53.         }
    54.  
    55.         public void OnScroll(PointerEventData eventData)
    56.         {
    57.             foreach (var handler in GetHandlers<IScrollHandler>())
    58.             {
    59.                 handler.OnScroll(eventData);
    60.             }
    61.         }
    62.     }
    63. }
     
  14. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,060

    Its working now, Thanks for quick reply :)
     
  15. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,060
    @ilih
    Getting following error when trying to filter tileview datasource.


    INTERNAL_get_anchoredPosition can only be called from the main thread.
    Constructors and field initializers will be executed from the loading thread when loading a scene.
    Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
    UnityEngine.RectTransform:get_anchoredPosition()
    UIWidgets.ListViewCustom`2:GetScrollValue() (at Assets/UIWidgets/Standart Assets/ListView/ListViewCustom.cs:883)
    UIWidgets.ListViewCustom`2:GetFirstVisibleIndex(Boolean) (at Assets/UIWidgets/Standart Assets/ListView/ListViewCustom.cs:1147)
    UIWidgets.TileView`2:GetFirstVisibleIndex(Boolean) (at Assets/UIWidgets/Standart Assets/TileView/TileView.cs:106)
    UIWidgets.ListViewCustom`2:UpdateView() (at Assets/UIWidgets/Standart Assets/ListView/ListViewCustom.cs:1263)
    UIWidgets.ListViewCustom`2:SetNewItems(ObservableList`1) (at Assets/UIWidgets/Standart Assets/ListView/ListViewCustom.cs:1353)
    UIWidgets.ListViewCustom`2:UpdateItems() (at Assets/UIWidgets/Standart Assets/ListView/ListViewCustom.cs:792)
    UIWidgets.ObservableList`1:EndUpdate() (at Assets/UIWidgets/Standart Assets/Utilites/ObservableList.cs:256)
     
  16. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    810
    I suppose you trying to filter items in separate thread.

    Fix:
    Replace UpdateItems() function in ListViewCustom.cs with following code:
    Code (CSharp):
    1.         protected bool DataSourceChanged = false;
    2.  
    3.         public override void UpdateItems()
    4.         {
    5.             DataSourceChanged = true;
    6.         }
    And replace Update() function:
    Code (CSharp):
    1.         void Update()
    2.         {
    3.             if (DataSourceChanged)
    4.             {
    5.                 DataSourceChanged = false;
    6.                 SetNewItems(DataSource);
    7.             }
    8.  
    9.             if (needResize)
    10.             {
    11.                 Resize();
    12.             }
    13.  
    14.             if (IsEndScrolling())
    15.             {
    16.                 EndScrolling();
    17.             }
    18.         }
     
    jGate99 likes this.
  17. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,060
    @ilih,
    Can you please expose an event on UpdateView?
    So i'm able to call GetVisibleComponents after that event.

    Code (CSharp):
    1.         public UnityEvent onUpdateView = new UnityEvent();
    2.  
    3. protected void UpdateView()
    4.         {
    5.  
    6.             onUpdateView.Invoke ();
    7.  
    8. }
     
  18. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    810
    Ok, but it will "OnUpdateView" starts with capital letter.
     
    jGate99 likes this.
  19. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,060
    @ilih
    Can you please create an example scene which uses SlideBlock as Proper Side Menu with atleast following features
    - Push
    - Scale Down

    If possible also add
    - Uncover
    - Slide Along
    - Slide Out

    Here are working examples of Side Menus
    http://semantic-ui.com/modules/sidebar.html#/examples

    I have also attached a sample scene where all you have to do is provide that effect (which is the actual magic :) ) but this file will save you some of your time.

    Thanks
     

    Attached Files:

    Last edited: Jul 29, 2016
  20. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,060
    Another important request if you can add that quickly is that when you touch content area (right area) then side menu should auto close (just like a real side menu)
    Thanks
     
  21. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    810
    Ok
     
    jGate99 likes this.
  22. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,060
    @ilih
    In current implementation of ListViewCustom, if i want to change DefaultItem on runtime then even though it seems to work but layout get little off/messy, and the reason is you expect user have a defaultitem and check it in start.

    Can you also add support for changing DefaultItem on runtime, and then do the needful changes?

    For example, currently if i change default item of different size in TileViewIcons layout doesnt properly calculate number of rows.

    Can you please fix this on urgent basis?

    Thanks
     
  23. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    810
    Added, update to 1.8.5b3
     
    jGate99 likes this.
  24. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,060
    @ilih,
    Thank you, Slideblock closes now.

    However TileViewIcons is still missing one row when switching to other DefaultItem, can you please check that?
     
  25. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,060
  26. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    810
    Fixed, please update to 1.8.5b4
     
  27. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,060
    @ilih,
    Thank you, TileViewIcons and SlideBlock are now working fine :)
     
  28. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,060
    @ilih,
    Getting following error on filtering


    INTERNAL_get_anchoredPosition can only be called from the main thread.
    Constructors and field initializers will be executed from the loading thread when loading a scene.
    Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
    UnityEngine.RectTransform:get_anchoredPosition()
    UIWidgets.ListViewCustom`2:GetScrollValue() (at Assets/UIWidgets/Standart Assets/ListView/ListViewCustom.cs:963)
    UIWidgets.ListViewCustom`2:GetFirstVisibleIndex(Boolean) (at Assets/UIWidgets/Standart Assets/ListView/ListViewCustom.cs:1227)
    UIWidgets.TileView`2:GetFirstVisibleIndex(Boolean) (at Assets/UIWidgets/Standart Assets/TileView/TileView.cs:106)
    UIWidgets.ListViewCustom`2:UpdateView() (at Assets/UIWidgets/Standart Assets/ListView/ListViewCustom.cs:1343)
    UIWidgets.ListViewCustom`2:SetNewItems(ObservableList`1) (at Assets/UIWidgets/Standart Assets/ListView/ListViewCustom.cs:1435)
    UIWidgets.ListViewCustom`2:set_DataSource(ObservableList`1) (at Assets/UIWidgets/Standart Assets/ListView/ListViewCustom.cs:68)
    ScreenList`5:FilterItems() (at Screens/ScreensList/ScreenList.cs:147)
    ScreenList`5:OnSearchChange(String) (at Screens/ScreensList.cs:85)


    What should i do on my side?
     
  29. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    810
    Please check 1.8.5b5
    I made some changes to improve multithreading support.
    But still support have some limitations: ListView.Start() should be called before using DataSource from other threads.
     
    Last edited: Aug 1, 2016
  30. Tinjaw

    Tinjaw

    Joined:
    Jan 9, 2014
    Posts:
    518
    I have a weird issue. It only happens in one scene in my program. I cannot reproduce this is a new program. I'm have no clue what is causing it, so I just wanted to ask if anybody has ever seen anything like this.

    I have a IconListView that constantly scrolls up to the top whenever the scrollbar is moved.
    https://www.dropbox.com/s/4vzemgwjs0mn17q/ScrollsUp.GIF
     
  31. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    810
    Please check Vertical axis settings in Input Manager (Edit->Project Settings->Input).
    May be left mouse button used as positive button or something similar.
     
  32. Tinjaw

    Tinjaw

    Joined:
    Jan 9, 2014
    Posts:
    518
    I took a look at that and I don't think that is it.

    I am messing now with screen sizes and ratios and scalings and such. I can't narrow it down quite yet, but the answer is in there somewhere as sometimes it stays still and other times it autoscrolls up.
     
  33. sebastien-barry

    sebastien-barry

    Joined:
    Dec 18, 2013
    Posts:
    53
    Hi,
    I've got the following problem with Treeview.
    I Bind items once by calling ClearAndBind(), everything is ok
    I Call ClearAndBind() once again, my items are in the wrong order and child in wrong parents if I scroll, items refresh and are ok.
    After the second call I can call ClearAndBind() as I want, it works.
    So my question is, what is the preoblem on the second call ?

    Here's my CLearAndBind function :
    Code (CSharp):
    1. public void ClearAndBind()
    2.         {
    3.             tree.Clear();
    4.            StartCoroutine (BindEndOfFrame());
    5.         }
    6.  
    7.         IEnumerator BindEndOfFrame()
    8.         {
    9.             yield return new WaitForEndOfFrame();
    10.  
    11.             (tree.Nodes as ObservableList<TreeNode<ITreeViewFxParameterItem>>).BeginUpdate ();
    12.  
    13.             //Binding tree code .....
    14.             (tree.Nodes as ObservableList<TreeNode<ITreeViewFxParameterItem>>).EndUpdate ();
    15.             tree.UpdateItems ();
    16.         }
     
    Last edited: Aug 2, 2016
  34. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    810
    What version of New UI Widgets you use?

    And "tree.UpdateItems();" call not needed.
     
    Last edited: Aug 2, 2016
  35. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    810
    Please also check how vertical scrollbar works with "UI/Scroll View" gameobject. It will help detect source of problem.
    And Vertical axis settings screenshot will be great too.
     
  36. sebastien-barry

    sebastien-barry

    Joined:
    Dec 18, 2013
    Posts:
    53
    I Use version 1.8.4
    and I have the same problem if I use or not "tree.UpdateItems();"
     
  37. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    810
    Please add this line after ".EndUpdate();" and remove "tree.UpdateItems();"
    Code (CSharp):
    1. tree.GetVisibleComponents().OrderBy(x => x.Index).ForEach(x => x.transform.SetAsLastSibling());
    If it works then somehow components order was messed.
     
  38. sebastien-barry

    sebastien-barry

    Joined:
    Dec 18, 2013
    Posts:
    53
    Ok that solve the problem. When you say order was messed you mean by UI Widget or my code ?

    Here the code I use to fill the tree view:
    Code (CSharp):
    1. IEnumerator BindEndOfFrame()
    2.         {
    3.             yield return new WaitForEndOfFrame();
    4.  
    5.             ObservableList<TreeNode<ITreeViewFxParameterItem>> newTree = new ObservableList<TreeNode<ITreeViewFxParameterItem>>();
    6.  
    7.             for (int i=0; i < fxControllerObject.Modules[ModulesDropDown.value].Categories.Length; i++)
    8.             {  
    9.                 newTree.Add (Node (new TreeViewFxParameterCustomItem ( fxControllerObject.Modules[ModulesDropDown.value].Categories[i].Name, TreeViewFxParameterCustomItem.TreeViewFxParameterType.Category ,null), new ObservableList<TreeNode<ITreeViewFxParameterItem>> ()));
    10.                 for (int j = 0; j < fxControllerObject.Modules [ModulesDropDown.value].Categories [i].ObjectParameters.Length; j++)
    11.                 {
    12.                     newTree[i].Nodes.Add (Node (new TreeViewFxParameterCustomItem ( fxControllerObject.Modules[ModulesDropDown.value].Categories[i].ObjectParameters[j].Name, TreeViewFxParameterCustomItem.TreeViewFxParameterType.Parameter,fxControllerObject.Modules[ModulesDropDown.value].Categories[i].ObjectParameters[j])));
    13.                 }
    14.  
    15.                 for (int k = 0; k < fxControllerObject.Modules [ModulesDropDown.value].Categories [i].SubCategories.Length; k++)
    16.                 {
    17.                     newTree[i].Nodes.Add (Node (new TreeViewFxParameterCustomItem ( fxControllerObject.Modules[ModulesDropDown.value].Categories[i].SubCategories[k].Name, TreeViewFxParameterCustomItem.TreeViewFxParameterType.SubCategory,null), new ObservableList<TreeNode<ITreeViewFxParameterItem>> ()));
    18.                     for (int l = 0; l < fxControllerObject.Modules [ModulesDropDown.value].Categories [i].SubCategories[k].ObjectParameters.Length; l++)
    19.                     {
    20.                         newTree[i].Nodes[k].Nodes.Add (Node (new TreeViewFxParameterCustomItem ( fxControllerObject.Modules[ModulesDropDown.value].Categories[i].SubCategories[k].ObjectParameters[l].Name, TreeViewFxParameterCustomItem.TreeViewFxParameterType.Parameter,fxControllerObject.Modules[ModulesDropDown.value].Categories[i].SubCategories[k].ObjectParameters[l])));
    21.                     }
    22.                 }
    23.             }
    24.             tree.Nodes = newTree;
    25.         }
     
  39. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    810
    Probably your code and not in BindEndOfFrame, but some components attached to DefaultItem gameobject, very high chance to Start(), OnEnable() or Awake() functions have some code to change hierarchy order, like transform.SetAsFirstSibling(), transform.SetAsLastSibling(), transform.SetSiblingIndex()
     
  40. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,060
    @ilih,
    @ilih,
    First of all, your fix for filtering worked, and now its working great.
    However now i see TileViewIcons missing rows again if i switch a default item on runtime
     
  41. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,060
    @ilih
    Can you please provide a horizonat list sample with variable width which automatically centres items if viewport is bigger than items otherwise left align (default).
    I tried making one but now im getting a lot of TMPro based errors.



    Trying to remove TextMeshPro Text (TMPro.TextMeshProUGUI) from rebuild list while we are already inside a rebuild loop. This is not supported.
    UnityEngine.UI.CanvasUpdateRegistry:UnRegisterCanvasElementForRebuild(ICanvasElement)
    TMPro.TextMeshProUGUI:OnDisable() (at Assets/TextMesh Pro/Scripts/TMPro_UGUI_Private.cs:212)
    UnityEngine.GameObject:SetActive(Boolean)
    UIWidgets.ListViewCustomHeight`2:CalculateItemHeight(TItem) (at Assets/UIWidgets/Standart Assets/ListView/ListViewCustomHeight.cs:388)
    UIWidgets.<SetItemsHeight>c__AnonStorey7A:<>m__C7(SparkVOTitleDescriptionThumbnail) (at Assets/UIWidgets/Standart Assets/ListView/ListViewCustomHeight.cs:253)
    System.Collections.Generic.List`1:ForEach(Action`1)
    UIWidgets.ObservableList`1:ForEach(Action`1) (at Assets/UIWidgets/Standart Assets/Utilites/ObservableList.cs:651)
    UIWidgets.ListViewCustomHeight`2:SetItemsHeight(ObservableList`1, Boolean) (at Assets/UIWidgets/Standart Assets/ListView/ListViewCustomHeight.cs:250)
    UIWidgets.ListViewCustomHeight`2:CalculateMaxVisibleItems() (at Assets/UIWidgets/Standart Assets/ListView/ListViewCustomHeight.cs:80)
    UIWidgets.ListViewCustomHeight`2:SizeChanged(Int32, Vector2) (at Assets/UIWidgets/Standart Assets/ListView/ListViewCustomHeight.cs:430)
    UnityEngine.Events.UnityEvent`2:Invoke(Int32, Vector2)
    UIWidgets.ListViewItem:OnRectTransformDimensionsChange() (at Assets/UIWidgets/Standart Assets/ListView/ListViewItem.cs:280)
    UnityEngine.UI.ScrollRect:LateUpdate()
     
  42. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    810
    Please update to 1.8.5b7 and check Sample Assets/TileView/TileViewIcons scene.

    I added ListViewCustomWidth, use it for horizontal list with variable width.
    Sample code and prefab located at Sample Assets/ListView/ListViewVariableWidth

    Set ListView.Containter.EasyLayout.GroupPosition = Middle Center and add LayoutElement to ListView.Containter.
    Set LayoutElement.MinWidth = viewport width
     
  43. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,060
    HorizontalList is working fine,

    as for missing row issue, your given sample is working fine, however mine doesnt
    and i tried to match everything you are doing but still same issue, ill prepare a demo and send you tomorrow for test.
    Thanks
     
  44. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,060
    Hi @ilih, any update for this one?
     
  45. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    810
    I'm still working on it.
     
    jGate99 likes this.
  46. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,060
  47. grimmy

    grimmy

    Joined:
    Feb 2, 2009
    Posts:
    396
    Im using Table to try to create a table. But How on earth do I populate it with my own data via script. There seems to be existing data (5 rows) being added to the default table prefab but I cant tell how for the life of me or where the data is coming from.

    Please help.
    Thanks
     
    Last edited: Aug 10, 2016
  48. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    810
    You should use DataSource property, it's have same interface as List<T>.
    So use "table.DataSource.Add(new_item);", "table.DataSource.Remove(item);", "table.DataSource[index] = new_item;" and so on to change data.
    Here is code samples, only difference will be with types - instead ListViewIcons and ListViewIconsItemDescription will be your own types.
     
  49. grimmy

    grimmy

    Joined:
    Feb 2, 2009
    Posts:
    396
    okay thanks. Could you tell me where the existing 5 items/rows get added from. It's a mystery how they ever get created.

    ..also, how can I access the table component. It seems that I need to includesome kind of 'using' in there but I don't know which class it need. I am already using UIWidgets.

    Cheers
     
    Last edited: Aug 10, 2016
  50. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    810
    Check DataSource property in Inspector window and set Size = 0.


    You need to specify used namespace, check file with table class for line "namespace NameSpaceName {
    //some code
    }" .
    Probably you use namespace UIWidgetsSamples, so using declaration will be:
    Code (CSharp):
    1. using UIWidgets;
    2. using UIWidgetsSamples;
     
unityunity