Search Unity

Question Need help with dropdown UI

Discussion in 'Editor & General Support' started by unity_2612830237F54D9F4790, Feb 25, 2024.

  1. unity_2612830237F54D9F4790


    Feb 20, 2024
    Hello, I am pretty new to Unity and I have encountered a problem that I apparently need code to fix. What I am trying to do is separate the option buttons. This is what my dropdown list currently looks like:
    Screenshot 2024-02-25 143539.png
    This is what I want the dropdown list to look like:
    However, I can only achieve the desired format through play mode, since it is the only time where the dropdown list will show up in the hierarchy menu, and since we all know, play mode changes are only temporary. Is there any way I can achieve the desired format through code, or any other way while still working like a normal dropdown UI? I've been stuck on this for a good while and would really appreciate the help.
  2. Kurt-Dekker


    Mar 16, 2013
    You don't need code.

    You need to go into the item template and adjust the anchoring and probably the parenting and then make your own inset button boundary.

    Pay attention to what is connected to the DropDown inspector itself and make sure things are still correct so it can inject the text, clone the template, etc.

    I did it like this, took about 3 or 4 minutes of fiddling. The only thing I added was the green item... see inspector closeup. I cloned the
    and moved it to just "under" the
    , then renamed it to

    I highly recommend doing it a few times (do it, delete it, do it again, etc.) on a Dropdown you don't care about until you're a real pro.

    Screen Shot 2024-02-25 at 12.52.36 PM.png Screen Shot 2024-02-25 at 12.52.50 PM.png Screen Shot 2024-02-25 at 12.52.41 PM.png

    Here's more anchoring notes... it's critical that you "get" how the anchoring works otherwise this will be endlessly infuriating to get right. :)

    Here are the official docs on how to make your UI handle various resolutions and aspect ratios cleanly:

    Here are some notes on UI Anchoring, Scaling, CanvasScaler, etc:
    Last edited: Feb 25, 2024
  3. unity_2612830237F54D9F4790


    Feb 20, 2024
    Thank you Kurt for replying, I'm sorry but I am still having a little bit of trouble trying to understand how to fix the problem.
    I know that the label, checkmark, and background are all what determine how the dropdown option will show. However, I still do not know how to separate them. I've been thinking if there is a way to separate the options after a certain amount of height or y-coordinates. I just can't seem to figure what settings to change. If you need any screenshots from my set up please don't hesitate to ask for them.