Search Unity

TextMesh Pro Dropdown Value update bug

Discussion in 'UGUI & TextMesh Pro' started by cp-, Oct 13, 2020.

  1. cp-

    cp-

    Joined:
    Mar 29, 2018
    Posts:
    78
    Hi @Stephan_B

    There's a bug in the SetValue() function of the dropdown causing the value not to update (and triggering no events etc).

    TMP_Dropdown.cs, line 421:
    Code (csharp):
    1. if (Application.isPlaying && (value == m_Value || options.Count == 0))
    should be
    Code (csharp):
    1. if (Application.isPlaying && (value == m_Value))
    Consider this use case:

    1. Inspector
    value
    is X (default 0).
    2. The app starts and has to wait for data. As there is no data is available it should fall back to the placeholder. Therefore I first set
    options
    to an empty array and
    value
    to -1. Looks okay as the placeholder is shown, but under the hood it never changes
    value
    to -1 because of the condition above: It stays X because I first set
    options
    to an empty array.
    3. When data is available I set
    options
    to a non-empty array. The setter (line 286) triggers
    RefreshShownValue()
    and displays the Xth option as selected. The user never selected an option but the component a) shows a arbitrary selection and b) never triggers the
    onValueChanged
    event even though the selected value now changed from the -1 we (tried to) set before to X.

    I don't know if here's the right place to report something like this, if not, please point me to the right direction.
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Reporting issues via the forum is totally fine. However, since I am traveling this week, I would kindly ask that you submit a bug report via the bug reporter as this will make it easier for me to track the issue and ultimately provide a solution / confirm that your change is fine.

    Please be sure to include the steps to reproduce the issue along with repro project. Once you have the Case # via email, please post it here as well as this will make it easier for me to find and get to it sooner.

    P.S. I will be back in town on Friday and should be able to look at this over the weekend.
     
  3. cp-

    cp-

    Joined:
    Mar 29, 2018
    Posts:
    78
    @Stephan_B Sorry I did not create a ticket. As you just replied to another thread I'm subscribed to I hope pinging you here will do :)