Search Unity

Question TMP_Dropdown.Items alternative?

Discussion in 'UGUI & TextMesh Pro' started by Senshi, Dec 9, 2021.

  1. Senshi

    Senshi

    Joined:
    Oct 3, 2010
    Posts:
    557
    Hey!

    Today I tried to upgrade a 2018.4 project to 2021.2 and found that the
    TMP_Dropdown.Items
    field (which returned
    m_items
    ) no longer exists. Is there any other way to access a dropdown's
    DropdownItem
    s?

    For context, I used this to compare against
    EventSystem.current.currentSelectedGameObject
    .

    Thanks!
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    What version of the TMP package are you using with 2021.2?

    The drop down between version 1.6.x and version 2.2.x and 3.2.x for Unity 2020.3 or newer should be the same. I don't recall removing .Items... I'll try to check tomorrow.
     
  3. Senshi

    Senshi

    Joined:
    Oct 3, 2010
    Posts:
    557
    Hey Stephan, thanks for your reply. I've since upgraded it further to 2022.1.0b as I was testing editor performance, but there it's on 3.0.6. I don't see an `Items` field there, but looking forward to your findings.
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Latest release is version 3.2.0-pre.2 which you have to manually add since Package Manager hides preview packages.

    I'll follow up tomorrow on the 'items' field.
     
  5. Senshi

    Senshi

    Joined:
    Oct 3, 2010
    Posts:
    557
    Alright, I'll give that a try. I was just about to post an update too: Same issue happened in 1.5.6 on the latest 2018.4 LTS release (36f1). Adding the getter back and changing the DropdownItem class to public does the job just fine, but might still be worth following up on. (I was on 1.5.3 originally, which I wanted to upgrade from due to an unrelated bug.)