Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

ListView for the new Unity UI

Discussion in 'Assets and Asset Store' started by GrantTheAnt, Sep 11, 2014.

  1. GrantTheAnt

    GrantTheAnt

    Joined:
    Jan 13, 2013
    Posts:
    19
    ListView for Unity UI is a ListView control for the new Unity UI framework. It's ideal for leaderboards, store screens, inventory screens and the like.

    It's modelled on the Windows Forms ListView control, and shares an almost identical code interface, meaning it's familiar, easy to use and flexible too.

    Also included in the package are 6 sample scenes that show how the ListView can be used - an RPG store screen, 2 leaderboards, a Spotify ListView, a Windows Explorer ListView, and an email ListView.

    Try it for yourself here!

    Features:
    • Largely code-compatible with the WinForms ListView (substantially similar class interface)
    • Configurable events for column clicked, selection changed, and item activated
    • Mouse wheel scrolling
    • Appearance can be fully customised via code or the Unity inspector, including:
    • Control background color and transparency
    • Heading and item background color and text color, size, font and style
    • Scroll bar background and thumb color
    • Scroll bar width
    • Gridline color, transparency and thickness
    • Item height
    • Selection color
    • Fully adjustable column widths (including auto-sizing to heading width or longest item width)
    • Horizontal and vertical scroll bars that only appear when required
    • Scroll bar thumbs auto-size to content
    • Automatic abbreviation of both heading and item text that are too long for their column
    • Full C# source code provided
    • 6 sample scenes included covering common business and gaming uses
    • Support available - contact us via listview@endgamestudios.com
    • As we want to provide the best ListView possible, we will also consider feature requests for future releases
    Note: ListView for Unity UI is built from the ground up for the new Unity UI system, and therefore is only compatible with Unity 4.6 Beta upwards.

    It's just been approved onto the asset store - feedback is welcome!
     
    hopeful likes this.
  2. sanuvin

    sanuvin

    Joined:
    Feb 11, 2014
    Posts:
    61
    Does it allow sorting of columns (ascending/descending) by clicking on the column header?
     
  3. GrantTheAnt

    GrantTheAnt

    Joined:
    Jan 13, 2013
    Posts:
    19
    Yes it does - in the same way as the WinForms listview.
     
  4. yudixiaok

    yudixiaok

    Joined:
    Aug 29, 2014
    Posts:
    17
    Does it allow Addding separator line and group by seperator key word like android list view?
     
  5. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    705
    It doesn't in the demo.
     
  6. GrantTheAnt

    GrantTheAnt

    Joined:
    Jan 13, 2013
    Posts:
    19
    @yudixiaok - No, it is modelled after the Windows/WinForms listview rather than the Android one. If enough people wanted these features, we could look at adding them. In the meantime, you do get full source code with the package, so you can customise how you need to.

    @Gekigengar - We've updated the web sample now to demonstrate column header click sorting - ascending & descending & sorting by text as well as custom game objects (a slider in this case).

    http://www.endgamestudios.com/listview/sample/
     
  7. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    705
    Weirdly, it still doesn't sort through header click.

    Maybe its just me..?
     
  8. GrantTheAnt

    GrantTheAnt

    Joined:
    Jan 13, 2013
    Posts:
    19
    Hmm, it should work. I've asked some other people to try it and it works for them too.

    All I can suggest is that your browser is loading an older, cached version of the .unity3D package? Maybe you could try to force a page reload? Is there a new button on the right side below the other buttons which says "Clicking a column header will sort"?
     
    Gekigengar likes this.
  9. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    705
    Cleared Cache, it works now!
    Amazing job!
     
  10. ercu

    ercu

    Joined:
    Aug 29, 2013
    Posts:
    6
    Does it support list item pooling? If yes you should add it to description. I need one with pooling support.
     
  11. GrantTheAnt

    GrantTheAnt

    Joined:
    Jan 13, 2013
    Posts:
    19
    Yes it does support pooling. But it also supports virtual items, which is better than pooling in Unity. Using pooling in Unity, if you have a very large list, there will still be a substantial delay as Unity creates all the objects. You may be able to hide this delay by showing the user something else at this point, but the virtual solution gets around this by only creating the relatively few items that are visible.
     
    ercu and hopeful like this.
  12. ercu

    ercu

    Joined:
    Aug 29, 2013
    Posts:
    6
    Thank you for your response.

    How can i make two-row list item, if i can? I want to have two Text items in List Item, but could not find a way to set second Text Object after i added it to ButtonItem. Is there a way without changing ListView.cs?
     
    Last edited: Mar 1, 2015
  13. GrantTheAnt

    GrantTheAnt

    Joined:
    Jan 13, 2013
    Posts:
    19
    Yes, since the Listview supports using GameObjects for each item, you should be able to create a GameObject and then have two children Text objects. You'll also likely want to increase the row height of the listview to accommodate two line rows.

    You can check out the "images and sliders" sample in the package to see how to implement custom GameObjects in listview items.
     
    Last edited: Mar 2, 2015
  14. CodingStudios

    CodingStudios

    Joined:
    Apr 19, 2010
    Posts:
    12
    I have a couple of questions.

    1. Does Listview support scrolling the list via code?

    2. Does it support infinite scrolling?


    Thanks,
    Richard
     
  15. GrantTheAnt

    GrantTheAnt

    Joined:
    Jan 13, 2013
    Posts:
    19
    Hi Richard,

    To answer your questions:

    Yes. Since it uses Unity UI scroll bars, you can set the position of the scroll bar in code.

    No, it has no support for this. Since the source code is available, you may be able to make modifications to achieve this.
     
  16. JohnTube

    JohnTube

    Joined:
    Sep 29, 2014
    Posts:
    66
    Hi @GrantTheAnt ,

    Your asset looks great, I have few questions :
    • Does it require the default ScrollRect component ?
    • What are the constraints to use this ? (for example they are clearly stated for this asset)
    • If this ListView supports object pooling and "virtual items" then it should handle circular/infinite scrolling out-of-box, why not ?
     
  17. GrantTheAnt

    GrantTheAnt

    Joined:
    Jan 13, 2013
    Posts:
    19
    Hi JohnTube,

    Thanks for your nice comment. To answer your questions:

    Yes, it uses ScrollRect to support kinetic scrolling.

    Sorry, I'm not sure I understand what you're asking - can you provide more info?

    It does support virtual items, but this does not automatically imply that it can handle infinite scrolling. It would take some more work to add infinite scrolling, and we're adding features where we can based on demand. For example, just last week we added keyboard & gamepad support. If there is more demand for infinite scrolling, it will move up the priority list. Also, you get full source code with the package, so you could conceivably add this yourself (although as I said, it's not quite so simple).
     
  18. JohnTube

    JohnTube

    Joined:
    Sep 29, 2014
    Posts:
    66
    @GrantTheAnt
    by constraints I meant :
    should the ScrollRect's MovementType be unrestricted
    should the ScrollRect's Inertia be disabled

    And I've already purchased your asset, it looks good...I don't know if I will use it right now for my current game.
    I was expecting a solution that makes use of prefabs with a custom item script and LayoutElement, an MVVM pattern (binding with INotifyPropertyChanged and INotifyCollectionChanged). I also though that the Content container object would contain ContentSizeFitter and xLayoutGroup.
     
  19. EdgarDrake

    EdgarDrake

    Joined:
    Jun 3, 2015
    Posts:
    1
    I need to make 1 cell (not 1 row) consists of nested game object. How do I make that?

    So far this plugin support this kind of format
    row: {field_1, field_2, field_3}

    but I want to make something like Trello:
    trello.PNG

    1 cell is consists of game object.

    I learn from the list and images example, but I still don't understand how to tweak this. Can you provide to support this/example? Thank you
     
  20. GrantTheAnt

    GrantTheAnt

    Joined:
    Jan 13, 2013
    Posts:
    19
    Hi Edgar,
    Thanks for purchasing the ListView. To approximate a control like your example image, you could use a ListView with a single column. Then, each row would only have one item in it. You could then create a custom GameObject for each item, like in your image, and set each item's custom control accordingly. If you wanted to replicate the full view of Trello you could use one ListView for each list of cards. The only limitation to be aware of is that the ListView expects each row to be the same height - as this replicates the behaviour of the Windows Forms control it is based upon.

    Hope that helps,

    Grant.
     
  21. adelphiaUK

    adelphiaUK

    Joined:
    Apr 6, 2014
    Posts:
    28
    I know this has been in the asset store a few months now but I've only just discovered it. However, before I purchase and use it I need to ask if it uses masking for the ScrollRect as my projects are based on Android and I know there are a number of devices that masking does not work on (specifically nVidia Tegra 4 devices).
     
  22. GrantTheAnt

    GrantTheAnt

    Joined:
    Jan 13, 2013
    Posts:
    19
    Hi Adelphia,

    Yes it does use masking. You are correct - in the latest versions of Unity there are bugs even on PC to do with masking. We've submitted an example scene to the Unity bug tracker a few weeks ago so hopefully they can resolve it in the near future. On PC at least, these masking issues did not exist in earlier version of Unity.
     
  23. adelphiaUK

    adelphiaUK

    Joined:
    Apr 6, 2014
    Posts:
    28
    Thanks for your reply. Yes, in 4.6 masking worked OK on Tegra 4 devices, it only started to go wrong in Unity 5. I too have submitted a bug / issue report which that have acknowledged as being a bug and have replicated it but, unfortunately, they have only given it a level 4 priority so I don't anticipate seeing a fix any time soon.

    Oh well, I'll hang off for the moment but I've added it to my "wish list" for when they do manage to resolve the masking bug as I think this is one of the more complex UI elements to create.
     
  24. GrantTheAnt

    GrantTheAnt

    Joined:
    Jan 13, 2013
    Posts:
    19
    Thanks Adelphia. It's true, unfortunately the masking problems have only (relatively) recently started showing up. Fingers crossed that the team at Unity can resolve them soon. And you're also correct that the listview is quite a complicated UI component to create, especially if you want features such as virtual scrolling for better performance.
     
  25. GrantTheAnt

    GrantTheAnt

    Joined:
    Jan 13, 2013
    Posts:
    19
    Hi Adelphia (and everyone) - Unity 5.2 has now been released and they have resolved the masking issue. They have notified us that the bug we submitted is now fixed, and in our testing so far today it does seem to be the case.
     
  26. adelphiaUK

    adelphiaUK

    Joined:
    Apr 6, 2014
    Posts:
    28
    Yippee!! I can finally upgrade my projects (although I need to verify this on my own device too)!
     
  27. willemsenzo

    willemsenzo

    Joined:
    Nov 15, 2012
    Posts:
    585
    Hi.

    The webplayer demo looked great so I had no doubts about your asset. I'm trying out the demo scenes but apparently I can not scroll through a listview without causing the editor to freeze. Also CPU usage goes up to 50 percent. It works for like a second or 2 before everything freezes and I have to restart Unity. I tried a couple of times with different demo scenes, even reimported the package, but no difference. Okay, I could try to work around the issue if I knew what's causing it, but I don't know what and I don't wish to spend my time on figuring this out to be honest. Try debugging while Unity is freezed, plus add the fact this asset was supposed to save me a lot of time. Maybe it's something related with Unity 5.2.2, I don't know, but I'm sure you know it better than me.:p
     
  28. GrantTheAnt

    GrantTheAnt

    Joined:
    Jan 13, 2013
    Posts:
    19
    Hi willemsenzo.

    That's strange! We've downloaded the latest Unity 5.2.2 today and tested the sample scenes without any problem on a fairly old laptop. Can you send us an email (listview@endgamestudios.com) so we can work it through with you and see if we can get to the root of the problem?