Search Unity

[solved] Beginners Question: No Dynamic Value For Dropdown Box

Discussion in 'Scripting' started by scythwolf, Apr 11, 2019.

  1. scythwolf

    scythwolf

    Joined:
    Dec 30, 2018
    Posts:
    49
    Hi!

    I just started out with unity and scripting and hoped I might find some hints to what happened here.
    I have an UI that works fine for all the sliders, buttons, text and so on. Only for the dropdown box I can't get a dynamic value for ValueChanged.
    upload_2019-4-11_11-24-0.png

    Here is the function in Visual Studio:
    upload_2019-4-11_11-24-55.png

    and here is the declaration for the dropdown:
    upload_2019-4-11_11-25-49.png

    As you can see in the function I show the values of the actual object and the value tha onChanged function gives me different values.
     
  2. scythwolf

    scythwolf

    Joined:
    Dec 30, 2018
    Posts:
    49
    Aaaaand while I was typing 'values' I recognized my stupidity. I write here the solution if another newbie like me has the same issue.
    Dropdown requires an int in the function, not a float. If you declare it the right way you immediately get the dynamic functionality :)
     
    rafayel_zealous likes this.