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.

[Unsolved] List View with different sized content entrys?

Discussion in 'Immediate Mode GUI (IMGUI)' started by genaray, Mar 25, 2018.

  1. genaray


    Feb 8, 2017
    Hey there !

    Im currently working on an little game... Therefore i need some list views to choose different options for example on buildings or stuff like that. Not every GameObject ( Entry ) in that list view should have the equal size... There should be some big buttons ( With more text for example ) and some smaller buttons. The Problem is the following ... Theres always a gap between the list view entrys... I cant modify the top or spacing value, because every entry got an different size... So how exactly do i deal with such an case ? I need an way without creating such a big gap...


    (Picture with the big gap between different sized content entrys)


    (Structure of the List View content)


    (Picture of the Content GameObject it self)
  2. Johannski


    Jan 25, 2014
    Take a look at the content size fitter. It will resize the parent to fit the height of the children, therefore the "gap" will be at the bottom. If you get more entries and want a scrollrect, the content size fitter also will be of great help!

    Edit: btw., there is also a Unity UI subforum, this one is actually for the old ui system as well as editor ui