Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Question Unity Runtime binding DropDownField index

Discussion in 'Unity 6 Beta' started by SebMaire, Sep 29, 2023.

  1. SebMaire

    SebMaire

    Joined:
    Feb 9, 2021
    Posts:
    13
    Hello,

    I am using the untiy runtime binding with Unity 2023.3.0a6 and I'm trying to bind a dropdown.
    So far I was able to bind the choices list and the index, changing value in code reflects change in UI.

    upload_2023-9-29_11-36-12.png

    The problem I have is that selecting something in the dropdown does not change the index value.
    I thought it would be caused by a default binding-mode being wrong so I switched to TwoWay but it does not seem to have any effect.
    Is this achievable through binding or am supposed to register to a change event ?

    Thank you !
     
  2. martinpa_unity

    martinpa_unity

    Unity Technologies

    Joined:
    Oct 18, 2017
    Posts:
    507
    Hi @SebMaire, when an item is selected from the dropdown menu, it should go through the
    value
    property of the
    DropdownField
    , which should in turn notify that the
    index
    has changed. The notification should be fired only if the underlying index actually changed.

    Can you check what happens in the
    PopupField<T>.value
    property when you select the item? The work should happen there.

    If the notification is not fired up, please report a bug with a repro case so that we can investigate.
    Thanks!
     
  3. martinpa_unity

    martinpa_unity

    Unity Technologies

    Joined:
    Oct 18, 2017
    Posts:
    507
    Had a quick look and there is indeed a bug in the property, we'll get it sorted.
    Thank you for raising it up!

    Edit: Link to the issue.
     
    Last edited: Oct 2, 2023
    SebMaire likes this.
  4. SebMaire

    SebMaire

    Joined:
    Feb 9, 2021
    Posts:
    13
    Hello,

    I was able to do it with a change event (don't remember the name of the callback), thanks for answering !
     
  5. martinpa_unity

    martinpa_unity

    Unity Technologies

    Joined:
    Oct 18, 2017
    Posts:
    507
    The fix should arrived swiftly. :)