A working, stylable combo box (drop down list)

Hmm, seems to be a bug in the comboBox when using 3 or less items in it (ItemsToDisplay = 4).
They wont show as they should, with 3 items the first item is blank and with 2 items both of them show up blank.

1 Like

Virror, thank You for Your feedback!
Here is a fix.

1914442–123510–ComboBox.unitypackage (14.8 KB)

Great, thanx!

Edit: Works perfectly now, very, very useful asset!

1 Like

One major issue, it can be used in a build : p
You need to get rid of the: AssetDatabase.LoadAllAssetsAtPath(“Resources/unity_builtin_extra”);
since you cant use UnityEditor stuff in builds.

Sorry for being such a bother : p

1 Like

This function wouldn’t ever run on build if assets were loaded before. Anyway, I have an idea. Will try it soon.

Even if it wont run, all scripts will still be compiled without access to the Editor stuff. I just commented it out for now : D

Hi kender, thanks for your script. I have a problem when you touch on dropdown, scale in differents resolutions on mobiles. For example samsung galaxy note 4, dropdown is very small.

Thanksssss

1 Like

Well, the new fix is ready. Images are imported in Editor script now. Fixed scroll on runtime ComboBox fill. Fixed scaling. Please let me know if it solved Your problem.

1919489–123905–ComboBox.unitypackage (15.7 KB)

By the way, You can resize ComboBox RectTransform. If You resize it through code, You should call UpdateGraphics();
All sizes will be recalculated immediately.

Great job, will get the new one right away!

I wanted to implement something very important, but forgot what exactly it is :smile: Will upload an update as soon, as will remember.
By the way, if anyone is interested, I am currently working on Calendar. Almost finished it. Then will additionally implement DatePicker.
Calendar screenshots

Got it!
Fixed overlay on screen size change. You should manually call UpdateGraphics(). Also, made some methods private.

Please let me know if You would like to have any other features.

1919882–123921–ComboBox.unitypackage (15.8 KB)

1 Like

Great Job!!!, Thanks

When I click on this combobox, it changes all my hierarchy order (I’m using some layout elements). Do you know why @Kender ?

Hello, @Kaz_Yamof . Sory for a long response.
Yes, that’s done for making dropdown list above all of the UI elements, so it forces all dropdown parents to be the last in their hierarchy.

@Kender
Yeah, but doing this the rendering order of my ui objects are affected. The items should be in front of my image by default, but your component is changing it :

@Kaz_Yamof , could You printscreen Your hierarchy, please?

Never had that issue, must be something with your GUI setup i think.

I believe, this may happen because image is lower then combobox. I just don’t know how to sort root items. If You put image over combobox’s root, this issue will disappear. Please let me know if this helps.

I imported all combobox package again and the problem is gone. Don’t know why.
But this issue persists: by the sort order of my UI groups (Layout Elements components), the combobox needs to be before the other image, causing the effect above.
Need to have some way to set an rendering priority on a UI item without affecting the hierarchy…