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,414
    Notify.cs, after line 5 add code
    Code (CSharp):
    1. using System.Linq;
    after line 328 add code
    Code (CSharp):
    1. slides = new Stack<RectTransform>(slides.Where(x => x!=null));
     
    OnAndOn likes this.
  2. blueFire

    blueFire

    Joined:
    Nov 27, 2010
    Posts:
    68
    I discovered the problem. I was giving the wrong path for the image (including "Assets/Resources" in the path). When I fixed this (just giving it the name of the image without a file extension or folder location) it worked.

    Another question. What is the best size to set the image size (x and y pixels) using Sprite.Create() with the ListViewIcons UI? And will it scale correctly on different screen sizes?

    Jason
     
  3. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,414
    In sample scene used sprites with width 30, height 15-20. Icons displayed with natize size.

    Scaling should be controlled with Canvas Scaler
     
  4. blueFire

    blueFire

    Joined:
    Nov 27, 2010
    Posts:
    68
    Another thing I have discovered is when I set the images to a size of 30 x 20 (in Sprite.Create()) only the top 30 pixels x 20 pixels of the image is shown in the ListViewIcon box. I am wanting to scale the entire image to fit in the 30 x 20 allocated area.

    Jason
     
  5. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,414
    Specify pixelsToUnits in Sprite.Create
    Code (CSharp):
    1.  
    2. var sprite_size = new Vector2(170f, 170f);
    3. var icon_size = new Vector2(30f, 20f);
    4. var pixels_to_units = Mathf.Max(sprite_size.x / icon_size.x, sprite_size.y / icon_size.y) * 100;
    5. sampleIcon = Sprite.Create(Resources.Load <Texture2D>("PATH TO IMAGE"),new Rect(0,0,170,170),new Vector2(0,0), pixels_to_units);
     
  6. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,414
    Version 1.3.3 released.
    • Added keyboard and gamepad support.
    • Bug fixes.
     
  7. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    @ilih ,

    Any chance you can be persuaded to do multi column and head row listviews in next release... ;)
     
  8. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,414
    Multiple columns can be done making new class derived from ListViewCustom. Check documentation and ListViewCustom Sample in scene.
    Header row will be added in next release.
     
  9. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    @ ilih - great - thanks
     
  10. Technipoet

    Technipoet

    Joined:
    Mar 5, 2014
    Posts:
    4
    Hey, I'm trying to use the basic combobox but when I call clear() I get this error.
    Code (CSharp):
    1.  
    2. ArgumentOutOfRangeException: Argument is out of range.
    3. Parameter name: index
    4. System.Collections.Generic.List`1[System.String].get_Item (Int32 index) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:633)
    5. UIWidgets.ListView+<NewSelectedIndicies>c__AnonStorey27.<>m__55 (Int32 x) (at Assets/UIWidgets/Standart Assets/ListView.cs:858)
    6. System.Linq.Enumerable+<CreateSelectIterator>c__Iterator10`2[System.Int32,System.String].MoveNext ()
    7. System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1D`1[System.String].MoveNext ()
    8. System.Collections.Generic.List`1[System.String].AddEnumerable (IEnumerable`1 enumerable) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:128)
    9. System.Collections.Generic.List`1[System.String]..ctor (IEnumerable`1 collection) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:65)
    10. System.Linq.Enumerable.ToList[String] (IEnumerable`1 source)
    11. UIWidgets.ListView.NewSelectedIndicies (IList`1 newItems) (at Assets/UIWidgets/Standart Assets/ListView.cs:860)
    12.  
    Setting the ListView.Strings = new List<string>(); also results in
    Code (CSharp):
    1. ArgumentOutOfRangeException: Argument is out of range.
    2. Parameter name: index
    3. System.Collections.Generic.List`1[System.String].get_Item (Int32 index) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:633)
    4. UIWidgets.ListView+<NewSelectedIndicies>c__AnonStorey27.<>m__57 (UIWidgets.ListViewStringComponent component) (at Assets/UIWidgets/Standart Assets/ListView.cs:875)
    5. System.Collections.Generic.List`1[UIWidgets.ListViewStringComponent].ForEach (System.Action`1 action) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:361)
    6. UIWidgets.ListView.NewSelectedIndicies (IList`1 newItems) (at Assets/UIWidgets/Standart Assets/ListView.cs:874)
    7. UIWidgets.ListView.UpdateItems (System.Collections.Generic.List`1 newItems) (at Assets/UIWidgets/Standart Assets/ListView.cs:812)
    8. UIWidgets.ListView.set_Strings (System.Collections.Generic.List`1 value) (at Assets/UIWidgets/Standart Assets/ListView.cs:51)
    9. WorldAskerScreen.Start () (at Assets/Scripts/Screens/WorldAskerScreen.cs:15)
     
  11. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,414
    It was fixed in version 1.3.3.1. Please download updated version.
     
    Technipoet likes this.
  12. Technipoet

    Technipoet

    Joined:
    Mar 5, 2014
    Posts:
    4
    Thanks! I updated but now it seems that the list items are being tiled in a grid instead of being vertically aligned like the normal listview. Not sure if this was intended or not.
     
  13. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,414
    Can you show me screenshot how it looks?
     
  14. RazaTech

    RazaTech

    Joined:
    Feb 27, 2015
    Posts:
    178
    Hi!
    First :
    i want to make Some thing like this
    ^A07527FCEC7E0922177B99DD6A8303B163528BCA4A40FC261E^pimgpsh_thumbnail_win_distr.jpg
    does List can make Custom List Item , like this...?

    Second :
    Can i populate list with thousands of item..????
    like virtual Layout ....????
     
  15. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,414
    Yes, but all items must be same height.

    Fast made sample:


    Yes, GameObjects will be created only for visible items.
     
  16. RazaTech

    RazaTech

    Joined:
    Feb 27, 2015
    Posts:
    178

    Does it mean if list show ten items at a time , and i scroll to 100, items will there b 100 GameObject Created or there will b 10 GO ?
    how many GameObject will b there?

    What i m looking is that there will b only 10- 15 GameObjects , Even though i will be Scrolling through thousands of items,
    this is an Example of what i m looking https://bitbucket.org/tacticsoft/tstableview

    there is an artical about vertualLayout http://corlan.org/2011/07/11/creating-flex-mobile-lists-part-ii-using-virtualization/
     
  17. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,414
    Will be created 11 GameObjects for items if DefaultItem consist from 1 GameObject (10+1 in case when top and bottom displayed items are visible only partially) and 2 GameObject to fill space of undisplayed top and bottom items.
     
    Last edited: Jun 18, 2015
  18. Knertified

    Knertified

    Joined:
    Jul 3, 2012
    Posts:
    31
    Seeing a problem after importing the latest version. I'm getting 4 errors in Unity when it tries to compile your software:

    Assets/UIWidgets/Standart Assets/ButtonAdvanced.cs(59,38): error CS0115: `UIWidgets.ButtonAdvanced.OnPointerUp(UnityEngine.EventSystems.PointerEventData)' is marked as an override but no suitable method found to override

    Assets/UIWidgets/Standart Assets/ButtonAdvanced.cs(49,38): error CS0115: `UIWidgets.ButtonAdvanced.OnPointerDown(UnityEngine.EventSystems.PointerEventData)' is marked as an override but no suitable method found to override

    Assets/UIWidgets/Standart Assets/ButtonAdvanced.cs(69,38): error CS0115: `UIWidgets.ButtonAdvanced.OnPointerEnter(UnityEngine.EventSystems.PointerEventData)' is marked as an override but no suitable method found to override

    Assets/UIWidgets/Standart Assets/ButtonAdvanced.cs(79,38): error CS0115: `UIWidgets.ButtonAdvanced.OnPointerExit(UnityEngine.EventSystems.PointerEventData)' is marked as an override but no suitable method found to override
     
    cgrow67 likes this.
  19. TonyT

    TonyT

    Joined:
    Mar 17, 2014
    Posts:
    20
    Hi

    Firstly I would like to thank you for your great product and excellent support.

    I seem to have hit a couple of bugs with ListView.

    In your demo you are able to populate the listview with 1000 objects. I ran in to a bug that I am able to reproduce in your demo by changing the 1000 objects to just 5 (modify the test code). The bug seems to be located in the section where "selected items" are maintained (i.e. UpdateItems). I have just commented out this and "deselected all" as a work around. (it is a bit weird in that you can go from 1000 -> 10 objects but not 10->5 or for your example the 8 or so in the file down to 5 objects).

    A second bug is that when I set the ListView via myinstance.Strings = alistofstrings; in my code it doesn't seem to resize the scrollbar properly. (it works for your example but in code (non UI driven) it only works in the Start function but not in any other code driven function). I tried to find out why but I haven't worked it out yet.

    Thanks again
     
    Last edited: Jun 19, 2015
  20. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,414
    I suppose you have own class Button in your code.
    Please replace code in ButtonAdvanced.cs, line 19:
    old line
    Code (CSharp):
    1. public class ButtonAdvanced : Button,
    new line
    Code (CSharp):
    1. public class ButtonAdvanced : UnityEngine.UI.Button,
     
  21. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,414
    Are you using latest version of asset? Those bugs was fixed, please download latest version 1.3.3.1.
     
    Last edited: Jun 19, 2015
  22. TonyT

    TonyT

    Joined:
    Mar 17, 2014
    Posts:
    20
    Excellent Thanks!!!
     
  23. RazaTech

    RazaTech

    Joined:
    Feb 27, 2015
    Posts:
    178
    hi , does List support tile layout??? if it is then you deserve more then 5 stars :)
     
    Last edited: Jun 20, 2015
  24. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,414
    Not in current version.
     
  25. RazaTech

    RazaTech

    Joined:
    Feb 27, 2015
    Posts:
    178
    i really need it ,in my current project , when will new version come???
     
  26. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,414
    Version with TileView may be released in late July or early August.
     
  27. alizdesk

    alizdesk

    Joined:
    Mar 26, 2015
    Posts:
    46
    +1 for TileView
     
  28. Technipoet

    Technipoet

    Joined:
    Mar 5, 2014
    Posts:
    4
    Capture.PNG
    the List under ComboboxListview -> Mask looks like it is using EasyLayout script while the normal listview uses a vertical layout group. Thanks for the responses!
     
  29. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,414
    Please specify horizontal stretch for DefaultItem. This should fix problem.
     
  30. steven williams

    steven williams

    Joined:
    Nov 27, 2012
    Posts:
    10
    Demo scene crashes Unity 4.6.6.f2 on load, The old demo scene loads ok.
     
  31. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,414
    It doesn't reproduce for me. Can you check again and show me editor.log if it happens?
     
  32. steven williams

    steven williams

    Joined:
    Nov 27, 2012
    Posts:
    10
    Sent you the editor.log
     
  33. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,414
    Probably scene file or some other files are broken on download, please try to redownload asset from store.
    Or may be some conflicts with existing pulgins or code, you should also try import asset to empty project.
     
  34. steven williams

    steven williams

    Joined:
    Nov 27, 2012
    Posts:
    10
    Re-downloaded, loading scene still crashes latest 4.6.6.f2, but works in 5.0.0.f4.
     
  35. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,414
    I send you message in forum inbox, please check it.
     
  36. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,414
  37. RazaTech

    RazaTech

    Joined:
    Feb 27, 2015
    Posts:
    178

    Thank you for making it work with the fixed height however unfortunately our application require variable height as we are showing news feed which often contain elements that increases element heights individually
    please advise
     
  38. steven williams

    steven williams

    Joined:
    Nov 27, 2012
    Posts:
    10
    Excellent support, thanks!


    A TreeView would be great :)
     
  39. johanneskopf

    johanneskopf

    Joined:
    Feb 16, 2015
    Posts:
    81
    Thanks for your great asset! Really well written and documented. :)

    For a game i need a sell/buy slider with a single value and the possibility to set the 0-value to the middle of the slider.
    Moving slider to the right - buy something
    Moving slider to the left - sell something
    Maximum buy/sell amount therefore have to be able to be different.

    Resulting functionality can be seen here:
    http://i.ytimg.com/vi/nc8J00ljYYY/maxresdefault.jpg

    Can you give me an advise how to achieve this with your slider?
     
    Last edited: Jun 26, 2015
  40. schragnasher

    schragnasher

    Joined:
    Oct 7, 2012
    Posts:
    117
    Hello, i have a combobox bug where the layout for the scrollbar content layout does not seem to update when i first open the dropdown and i cannot scroll. After closing and reopening it seems to work.

    First Open


    Second Open
     
  41. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,414
    It's possible to make ListView with items of variable heights, but it is requires function which calculate height of items.

    It's possible using RangeSliderBase and RangeSlider as example
    • rework them to make slider with only one handle
    • change functions ValueToPosition and PositionToValue to work with 0 at center
    • change UpdateFill function to fill from center to handle.
    You can check this slider in demo version 1.4.1
    Version 1.4.1 will be available to download after AssetStore approval.

    What is version Unity version and asset version?
     
    johanneskopf likes this.
  42. schragnasher

    schragnasher

    Joined:
    Oct 7, 2012
    Posts:
    117
    Unity 5.0.0 , not updated yet. And the latest version in the store, 1.4.0.
     
  43. johanneskopf

    johanneskopf

    Joined:
    Feb 16, 2015
    Posts:
    81
    Wow, that was fast. And you included it into the example and the asset too. Thank you very much!
     
  44. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,414
    Is it also happen with combobox in sample scene and combobox created from menu? (GameObject/UI/Combobox)
     
  45. schragnasher

    schragnasher

    Joined:
    Oct 7, 2012
    Posts:
    117
    not really, it does seem to update right after opening. It quickly changes.

    Its odd though, i can see the items the hierarchy in my combobox, but it doesnt update until i reopen.
     
  46. ilih

    ilih

    Joined:
    Aug 6, 2013
    Posts:
    1,414
    Please check:
    • ComboboxListView in should have specified ScrollRect
    • GameObject List in ComboboxListView should have EasyLayout, not Vertical Layout Group


     
  47. johanneskopf

    johanneskopf

    Joined:
    Feb 16, 2015
    Posts:
    81
    Hi again ilih,
    Is there a way to have a fixed column-cellsize?
    listview_grid_not_working.PNG
    I use your custom listview with easylayout-grid inside vertical easylayout, therefore it's not a big single grid. I know that's the reason why it's not working like a grid with fixed column-cellsize.
    But are you going to implement this relating to the header row (fixed column size with header?):
     
  48. schragnasher

    schragnasher

    Joined:
    Oct 7, 2012
    Posts:
    117
    All ok, is there a specific time i should add them? Awake/start? Some sort of ordering issue? Its random, but sometimes it works fine o.0
     
  49. schragnasher

    schragnasher

    Joined:
    Oct 7, 2012
    Posts:
    117
    I see now your doing some virtualization, This makes me think more its an ordering issue perhaps?


    EDIT:
    I checked the component, i see all of my options in the Items view on the editor, so it has them in memory, but i open the listview and the problem persists. Is there a way to force it to check for items?

    EDIT:
    Made a totally new scene, added a combobox, increased its itemlist to 10, problem persists.

    EDIT:
    Made a new PROJECT imported controls, made canvas, added CB, increased items to 10, same issue. I can't be the only one with the problem. :)

    EDIT:
    Last try, got the latest Unity version, same issue.
     
    Last edited: Jun 30, 2015
  50. RazaTech

    RazaTech

    Joined:
    Feb 27, 2015
    Posts:
    178
    Can you Give Some Example plz ...???:rolleyes: