Search Unity

New UI Widgets

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

  1. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,415
    I don't know, adding infinite loops can take a lot of time.
     
  2. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,945
    not infinite loop
    what i want is i can provide it a list of data, and it show 1 image (an item which can be image or complex) per view. There are only 3 views active at one time even when items are 100
    Its just like TileFitter but without Choppy Movement of ScrollRect and i guess without ScrollRect.
     
  3. sylvain

    sylvain

    Joined:
    Feb 19, 2013
    Posts:
    46
    Thanks !
    Like a charm
     
  4. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,945
    @ilih any update ?

     
  5. sebastien-barry

    sebastien-barry

    Joined:
    Dec 18, 2013
    Posts:
    54
    Hi I have a problem with SpinnerFloat in last release.
    Spinner setting before application start :
    - Min = 0
    - Max = 50
    - Value = 0​
    Spinner change when application running :
    - Min = 0.25
    - Max = 50
    - Value = 0.25
    After that my value spinner Value is equal to 25 !​
    Any idea ?
    It seams Spinner float do not support float Min max values (ex : 0.25), (no problem with int values (ex : 1.0))

    Similar problem with IntSpinner
     
    Last edited: Apr 29, 2016
  6. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,415
    I'll try to do something on weekend.

    Unity 5.4? In this case replace line in SetValue(), SpinnerFloat.cs
    Old line:
    Code (CSharp):
    1. text = _value.ToString(format);
    New line:
    Code (CSharp):
    1.             #if UNITY_5_3_4 || UNITY_5_4 || UNITY_5_5
    2.             if (m_Text!=_value.ToString(format))
    3.             {
    4.                 m_Text = _value.ToString(format);
    5.                 UpdateLabel();
    6.             }
    7.             #else
    8.             text = _value.ToString(format);
    9.             #endif
    For Spinner
    Old line:
    Code (CSharp):
    1. text = _value.ToString();
    New line:
    Code (CSharp):
    1.             #if UNITY_5_3_4 || UNITY_5_4 || UNITY_5_5
    2.             if (m_Text!=_value.ToString())
    3.             {
    4.                 m_Text = _value.ToString();
    5.                 UpdateLabel();
    6.             }
    7.             #else
    8.             text = _value.ToString();
    9.             #endif
     
    Last edited: Apr 29, 2016
  7. sebastien-barry

    sebastien-barry

    Joined:
    Dec 18, 2013
    Posts:
    54
     
    Last edited: Apr 29, 2016
  8. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,415
    Found such line in 5.3.4p2 changelog
    And this is source of problem.

    So replace line in previous fix
    Code (CSharp):
    1. #if UNITY_5_4 || UNITY_5_5
    on
    Code (CSharp):
    1. #if UNITY_5_3_4 || UNITY_5_4 || UNITY_5_5
     
  9. sebastien-barry

    sebastien-barry

    Joined:
    Dec 18, 2013
    Posts:
    54
    Ok Work great Thanks
     
  10. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,945
    Greatly appreciate :)
     
  11. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,945
    @ilih
    Sent you an email with easy layout problem project. please take a look
     
  12. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,415
    Already replied.
     
    jGate99 likes this.
  13. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,415
    Please check 1.8.2beta6, "Sample Assets/TileView/TileView" scene
     
    jGate99 likes this.
  14. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,945
    Thank you for your help again,
    Its much better, however this is one remaining issue and that user is still able to see atleat 2-3 tiles in one touch session, here is the image
    http://www.giphy.com/gifs/l4Ho1VwXnp6JpfI3u
     
  15. Aston-Martin

    Aston-Martin

    Joined:
    Jul 5, 2012
    Posts:
    64
    Feedback on the beta line connector, single/multiple line works.
    But placed inside a scrollview, the masking deosn't seems to work... possible to fix the masking?
    Screen Shot 2016-05-03 at 7.11.19 PM.png
     
  16. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,415
    Fix: ConnerctorBase.cs, replace line
    Code (CSharp):
    1.     public abstract class ConnectorBase : Graphic
    on
    Code (CSharp):
    1.     public abstract class ConnectorBase : MaskableGraphic
     
  17. Aston-Martin

    Aston-Martin

    Joined:
    Jul 5, 2012
    Posts:
    64
    Ok, solved. thank you!
     
  18. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,945
    @ilih, another problem i see is that even when i start scroll for few pixels it goes to next/previous slide. it should only go to next/previous slide if next/previous item is half visible OR user scroll really fast.

     
  19. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,415
    I'll try to update in few days.
     
    jGate99 likes this.
  20. Aston-Martin

    Aston-Martin

    Joined:
    Jul 5, 2012
    Posts:
    64
    Feedback 2 : connector.
    Scenario : connecting from button3 (top) to button4 (bottom) works.
    When button3 adjusted to a further distance from button4, the connector line terminating point shifted and overshoot the button. Possible to fix this ?


    Screen Shot 2016-05-05 at 6.23.07 PM.png
     
  21. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,415
    Yes, I'll upload update few hours later.
     
  22. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,415
    Here is fixed version.
     
  23. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,415
    Check 1.8.2beta10
     
    jGate99 likes this.
  24. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,945
    @ilih, i cant thank you enough :) let me check it right away
     
  25. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,945
    @ilih, thats exactly what a pro slider is. Its launchable
    there is 1 minor issue which is item is not centred properly horizontally, its left edge is hidden and i see previous item's edge on right side.
    I believe you can fix it in next update so im gonna use it now.

    Now as this one is working great, can i use same functionality in Tile View? with dynamic items per page? Can you provide a new sample in next update with both 1 item per view and dynamic items (item with fixed height width but show 1 page according to drawable items in that space)
     
  26. Can-Baycay

    Can-Baycay

    Joined:
    Dec 14, 2010
    Posts:
    27
    I was trying to show dialogs and I've bumped into a bug which was not a pleasant experience :) Here is the fix that worked for me:

    UIWidgets\Standart Assets\Templates.cs
    Code (CSharp):
    1.     void AddTemplate(T template)
    2.     {
    3.         // Fix start
    4. #if UNITY_EDITOR
    5.         if (UnityEditor.PrefabUtility.GetPrefabParent(template.gameObject) == null &&
    6.             UnityEditor.PrefabUtility.GetPrefabObject(template.gameObject) != null)
    7.             return;
    8. #endif
    9.         // Fix end
    10.  
    11.         Add(template.name, template, replace: true);
    12.         template.gameObject.SetActive(false);
    13.     }
    14.  
    Basically, "Resources.FindObjectsOfTypeAll<T>().ForEach(AddTemplate);" is designed to find scene objects of type T whether the object is disabled or not. I figured the reason Object.FindObjectsOfTypeAll was not used is Resources.FindObjectsOfTypeAll finds disabled scene objects too. But Resources.FindObjectsOfTypeAll also finds prefabs which is not what we want to do since the found object is used in "template.transform.SetParent(templates[name].transform.parent, false);" line which eventually throws an exception when the "templates[name]" points to a prefab instead of a scene object. So I decided to exclude prefab objects in "AddTemplate" method and that fixed the problem.

    Fun fact is, in my case, "Resources.FindObjectsOfTypeAll" returns one scene object and one prefab object. The order of returned objects is a mistery so sometimes "template[name]" points to the prefab (wrong) and sometimes it points to the scene object (correct). It's hard to find a way to reproduce the bug every time.

    That would be great if you could validate the fix is correct.
     
  27. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,415
    Can you show stack trace and code that cause error with "template.transform.SetParent(templates[name].transform.parent, false);"? So I be able to reproduce it.

    Here is two ways to display dialog:
    • dialogSample.Template().Show(...)
    • Dialog.Template("DialogTemplate").Show(...)
    And I cannot find way to cause such error with this.
     
    Last edited: May 13, 2016
  28. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,415
    Please check 1.8.2beta12, "Sample Assets/TileView/TileView" scene
     
    jGate99 likes this.
  29. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,945
    Thanks for the update. Its launchable so i decided to implement it in a real app.

    However this is not useable due to following main reasons.
    1- In a real app, there will be margin so items are close to tablet edges. So i added margin in easy layout and after that it didnt work as expected.
    2- In some case if i want to give fix columns, so tilelist is taking 100% width and height of screen, and items are in centre (alignment). This is also not possible as i tried giving fixed column and tileview didnt work as expected.
     
  30. Lexxxx

    Lexxxx

    Joined:
    Dec 30, 2015
    Posts:
    2
    Hello,
    I have some problems with run debug TreeView component on ios devices (such as Ipad mini, iphone 5), but process of compilation was good.
    From Xcode:

    - Completed reload, in 0.159 seconds
    UIWidgets.ObservableList<UIWidgets.TreeNode<UIWidgets.TreeViewItem>> doesn't implement interface System.Collections.Generic.IEnumerable<UIWidgets.TreeNode<TItem>>

    * Assertion: should not be reached at mini-trampolines.c:183
     
  31. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,415
    Please try to increase trampolines count:
    Edit / Project Settings / Playes / iOS / Other Settings
    AOT Compilation Options = nimt-trampolines=2048;nrgctx-trampolines=4096;ntrampolines=4096


    And replace all occurrences "IObservableList" on "ObservableList" in TreeNode.cs and TreeViewCustom.cs
     
  32. Lexxxx

    Lexxxx

    Joined:
    Dec 30, 2015
    Posts:
    2
    Thanks for the quick response. Component worked when I compiled with utility IL2CPP
     
  33. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,415
    EasyLayout is inside ScrollRect, so layout margin cannot be used for such purpose.
    You should set one of ScrollRect parent gameobjects RectTransform anchors to stretch and use Left/Top/Right/Bottom to specify margin.


    Check 1.8.2beta14
     
  34. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,945
    sent you private message.
     
  35. sebastien-barry

    sebastien-barry

    Joined:
    Dec 18, 2013
    Posts:
    54
    Hi,
    Can you give a little example that show how to use a filter function with custom listview
    I do it with Treeview, but I don't know how to set IsVisible attribute like nodes with listview.
    Thanks in advance.
     
  36. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,415
    Most simple way is using Where function.
    Code (CSharp):
    1. using System.Linq;
    2.    //...
    3.    DataSource = OriginalItems.Where(x => x.UserName==name).ToObservableList();
    But you need to keep original items in another list.

    Or you can create wrapper for DataSource and use it instead, here is sample, you need only replace ChatLine with you own item type.
    Code (CSharp):
    1. using UIWidgets;
    2. using System.Linq;
    3. using System;
    4.  
    5. namespace UIWidgetsSamples {
    6.     public class ChatView : ListViewCustomHeight<ChatLineComponent,ChatLine> {
    7.         #region DataSource wrapper with Filter
    8.         ObservableList<ChatLine> fullDataSource = new ObservableList<ChatLine>();
    9.  
    10.         public ObservableList<ChatLine> FullDataSource {
    11.             get {
    12.                 return fullDataSource;
    13.             }
    14.             set {
    15.                 if (fullDataSource!=null)
    16.                 {
    17.                     fullDataSource.OnChange -= UpdateDataSource;
    18.                 }
    19.                 fullDataSource = value;
    20.                 if (fullDataSource!=null)
    21.                 {
    22.                     fullDataSource.OnChange += UpdateDataSource;
    23.                 }
    24.                 UpdateDataSource();
    25.             }
    26.         }
    27.  
    28.         // filter function
    29.         Func<ChatLine,bool> filter;
    30.  
    31.         public Func<ChatLine, bool> Filter {
    32.             get {
    33.                 return filter;
    34.             }
    35.             set {
    36.                 filter = value;
    37.                 UpdateDataSource();
    38.             }
    39.         }
    40.  
    41.         void UpdateDataSource()
    42.         {
    43.             DataSource.BeginUpdate();
    44.             DataSource.Clear();
    45.             if (filter!=null)
    46.             {
    47.                 DataSource.AddRange(FullDataSource.Where(Filter));
    48.             }
    49.             else
    50.             {
    51.                 DataSource.AddRange(FullDataSource);
    52.             }
    53.             DataSource.EndUpdate();
    54.         }
    55.  
    56.         bool isStarted;
    57.  
    58.         public override void Start()
    59.         {
    60.             if (isStarted)
    61.             {
    62.                 return ;
    63.             }
    64.  
    65.             isStarted = true;
    66.  
    67.             base.Start();
    68.  
    69.             if (fullDataSource==null)
    70.             {
    71.                 fullDataSource = new ObservableList<ChatLine>();
    72.                 fullDataSource.AddRange(DataSource);
    73.                 fullDataSource.OnChange += UpdateDataSource;
    74.  
    75.                 UpdateDataSource();
    76.             }
    77.         }
    78.         #endregion
    79.  
    80.         protected override void SetData(ChatLineComponent component, ChatLine item)
    81.         {
    82.             component.SetData(item);
    83.         }
    84.  
    85.         // leave coloring functions empty
    86.         protected override void HighlightColoring(ChatLineComponent component)
    87.         {
    88.         }
    89.  
    90.         protected override void SelectColoring(ChatLineComponent component)
    91.         {
    92.         }
    93.      
    94.         protected override void DefaultColoring(ChatLineComponent component)
    95.         {
    96.         }
    97.     }
    98. }
    99.  
    And using FullDataSource with Filter:
    Code (CSharp):
    1.         ChatView SomeChatView;
    2.  
    3.         public void UsingListView()
    4.         {
    5.             SomeChatView.FullDataSource.Add(new ChatLine() {
    6.                 UserName = "some name",
    7.                 Message = "message",
    8.                 Time = DateTime.Now,
    9.                 Type = ChatLineType.User
    10.             });
    11.  
    12.             // display only items with UserName=="some name"
    13.             SomeChatView.Filter = x => x.UserName=="some name";
    14.             // or it can be like this
    15.             //SomeChatView.Filter = x => x.IsVisible;
    16.         }
     
  37. sebastien-barry

    sebastien-barry

    Joined:
    Dec 18, 2013
    Posts:
    54
    Thanks
     
  38. Tinjaw

    Tinjaw

    Joined:
    Jan 9, 2014
    Posts:
    518
    Does somebody have an example of using OnValueChanged with a switch? I don't know how to use it.
     
  39. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,415
    Here is sample code:
    Code (CSharp):
    1. using UnityEngine;
    2. using UIWidgets;
    3.  
    4. namespace UIWidgetsSamples {
    5.     public class SwitchTest : MonoBehaviour
    6.     {
    7.         [SerializeField]
    8.         Switch Switch;
    9.  
    10.         void Start()
    11.         {
    12.             if (Switch!=null)
    13.             {
    14.                 Switch.OnValueChanged.AddListener(OnSwitchChanged);
    15.             }
    16.         }
    17.  
    18.         void OnSwitchChanged(bool status)
    19.         {
    20.             Debug.Log("switch status: " + status);
    21.         }
    22.  
    23.         void OnDestroy()
    24.         {
    25.             if (Switch!=null)
    26.             {
    27.                 Switch.OnValueChanged.RemoveListener(OnSwitchChanged);
    28.             }
    29.         }
    30.     }
    31. }
     
    Tinjaw likes this.
  40. theboosted_1

    theboosted_1

    Joined:
    Aug 21, 2013
    Posts:
    21
    Hello,
    I am using your accordion widget and would like to be able to click a separate standard unity UI button to select and expand a menu option in the accordion widget. what is the simplest way do to this? I tried
    ToggleItem(AccordionItem item) from the docs but did not have any luck.
    Thanks for your time
     
  41. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,415
    You need to know item index or find item using ToggleObject or ContentObject and then call Accordion.Open() with required item.

    Here is sample code:
    Code (CSharp):
    1. using UnityEngine;
    2. using UIWidgets;
    3.  
    4. namespace UIWidgetsSamples {
    5.     public class AccordionTest : MonoBehaviour
    6.     {
    7.         [SerializeField]
    8.         Accordion TestAccordion;
    9.  
    10.         [SerializeField]
    11.         GameObject ToggleGameObject;
    12.  
    13.         public void Test()
    14.         {
    15.             // find required item by toggle object
    16.             var item = TestAccordion.Items.Find(x => x.ToggleObject==ToggleGameObject);
    17.             // or content object
    18.             //var item = TestAccordion.Items.Find(x => x.ContentObject==ContentGameObject);
    19.             // or get item by index
    20.             //var item = TestAccordion.Items[0];
    21.  
    22.             // and expand item
    23.             TestAccordion.Open(item);
    24.             //TestAccordion.Close(item);
    25.             //TestAccordion.ToggleItem(item);
    26.         }
    27.  
    28.         public void SimpleToggle()
    29.         {
    30.             var component = ToggleGameObject.GetComponent<AccordionItemComponent>();
    31.             component.OnClick.Invoke();
    32.         }
    33.     }
    34. }
     
  42. theboosted_1

    theboosted_1

    Joined:
    Aug 21, 2013
    Posts:
    21
    Works perfectly. Much appreciated.
     
  43. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,945
    @ilih
    Any update on stable/improved implementation of horizontal flat carousel control?
     
    zyzyx likes this.
  44. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,415
    I remember about it, probably tomorrow.
     
    jGate99 likes this.
  45. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,415
    Check "Sample Assets/TileView/TileViewIcons" scene in 1.8.2beta15
     
    jGate99 likes this.
  46. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,945
    First of all, welldone on a fantastic job as it works great.
    Now i tested it with different situations, and good thing is its also responsive, increasizing size of game window redraw more items, and decreasing size redraw less.

    Now on issues. Increasing Easy Layout's margin or spacing messes up the layout. Please check this.
     
  47. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,415
    Can you provide video or screenshoots explaining problem?
     
  48. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,945
    @ilih,
    Please check this, when i increased spacing, it renders less item (fine so far), but when i start to scroll to next page instead of showing item item 2 or 3 its showing item 4 and 5.
    Please advise
     

    Attached Files:

    • 1.gif
      1.gif
      File size:
      707.6 KB
      Views:
      805
    • 2.gif
      2.gif
      File size:
      550.5 KB
      Views:
      783
  49. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,415
    You should invoke OnResize event in ScrollRect.ResizeListener after changing layout settings.
    Code (CSharp):
    1. using UIWidgets;
    2. using UnityEngine;
    3.  
    4. namespace UIWidgetsSamples
    5. {
    6.     public class TileViewIconsTest : MonoBehaviour
    7.     {
    8.         public void ChangeLayoutSettings()
    9.         {
    10.             var tiles = GetComponent<TileViewIcons>();
    11.             tiles.Layout.Spacing = new Vector2(5, 50);
    12.             tiles.Layout.UpdateLayout();
    13.  
    14.             tiles.ScrollRect.GetComponent<ResizeListener>().OnResize.Invoke();
    15.         }
    16.     }
    17. }
     
  50. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,945
    Can you please make it automatic?