Issue in the ValueDropdown documentation

Issue #312 resolved
Jérémy Guéry created an issue

Hey!

I tried to use the [ValueDropdown()] attribute with a method member in parameter.

I had to change the return type of that method: IList became IList<ValueDropdownItem<int>>

Here is the code sample in the documentation:

// Member function that returns an object of type IList.
    private IList ValuesFunction()
    {
        return new ValueDropdownList<int>
        {
            { "The first option",   1 },
            { "The second option",  2 },
            { "The third option",   3 },
        };
    }

    [ValueDropdown("ValuesFunction")]
    public int MyInt;

And here is the modified code:

// Member function that returns an object of type IList.
        private IList<ValueDropdownItem<int>> ValuesFunction() {
            return new ValueDropdownList<int>
            {
                { "The first option",   1 },
                { "The second option",  2 },
                { "The third option",   3 },
            };
        }

        [ValueDropdown("ValuesFunction")]
        public int MyInt;

See the attachement to view the error.

Odin Version: 1.0.6.1

Unity Version: 2017.1.0p3

OS: Windows 10

Thanks!

Comments (1)

  1. Log in to comment