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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Question Dropdown ScrollView Scrollbar Handle is showing off of the scrollbar

Discussion in 'Editor & General Support' started by epratt, Dec 16, 2022.

  1. epratt

    epratt

    Joined:
    Oct 15, 2019
    Posts:
    16
    I'm loading options in a Dropdown object dynamically. I first load it with one option in the Start() method, but then run a coroutine that takes 5-10 seconds to process a large set of information (1500+ records) to create a new set of options (Usually ends up being around 20-30 new options).

    When the coroutine finishes running and assigns the new option list to the Dropdown's options, the scrollbar handle when the dropdown is expanded shows up off of the scrollbar.



    Does anyone know what might cause this?

    The dropdown exists in the following hierarchy (GameObject objects are Empty GameObjects):
    upload_2022-12-16_10-20-28.png

    Content has a Vertical Layout Group and Content Size Fitter on it with the following configuration
    upload_2022-12-16_10-21-20.png

    Dropdown Component:
    upload_2022-12-16_10-22-39.png

    ScrollRect of the Template in the Dropdown object:
    upload_2022-12-16_10-23-45.png

    Scrollbar under Template:
    upload_2022-12-16_10-24-19.png
     
  2. epratt

    epratt

    Joined:
    Oct 15, 2019
    Posts:
    16
    Nevermind. It turns out I'm a moron. I don't know when it happened, but the transform of the Sliding Area object in the template had been modified. So it didn't matter if anything was added to the dropdown at all... it would always be offset.

    Feel free to rebuke me.
     
    Kurt-Dekker likes this.
  3. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,814
    The UI stuff is generally pretty good about updating itself when needed.

    Also, did you know you can see the actual source code for the UI stuff? It's in your package cache, or you can view it on github. This is handy in case you wanna make your own variant.