ValueDropdown doesn't display the string associated with the selected item

Issue #736 resolved
Vlad Moldovanov created an issue

1. What happened?

When using the ValueDropdown attribute, the following situation occurs:
After selecting an item in the dropdown list, the top of the dropdown doesn't display the string associated with the selected item. See the attached video.

The code looks so:

FYI: The instance object exists in the scene. And string values took the correct values inside the ValueDropdown.
In my code, both filling methods of the ValueDropdownList lead to the same result.

2. How can we reproduce it?

I’d recommend trying use any class for the ValueDropdownList, like on my trying below (in red rects):

In this case, you will get the same result (see below):

3. If screenshots would help explain or demonstrate your issue, please include these.

The video with a demonstration of the issue has been attached. As and a screenshot.

4. What version of Unity are you using?

I’m using Unity 2020.2.1f1 Personal.

5. What version of Odin are you using? (See "Tools > Odin Inspector > About")

version 3.0.3

6. Do you have Editor Only mode enabled?

I didn’t understand the question. But if you mean that I used the issue code for Editor only that Yes, I did.

7. What operating system are you on?

Win10 Home

Comments (3)

  1. Vlad Moldovanov reporter

    I've figured out a solution for the issue:

    In the block “How can we reproduce it?“, the “class TryData” should be changed on the “struct TryData”… In this case, ValueDropdown displays the correct string, associated with the selected item. And, as I understood, the reason for the issue is, it requires to use of only data that have value semantics, i.e. structures. While class types have reference semantics.

    That isn’t good news for me. Because structs are value types and are copied on assignment. When I planned used "class TryData" as an object that described the property of a game-item.
    I hope that in the future the Odin will get a possibility of using the reference type for the ValueDropdown.

  2. Log in to comment