Need basic help assigning values to dropdown menu

Hi. I need some help. I recently started to try and learn buttons and dropdown menus so I can create a HUD (heads up display) button system for a virtual world containing many scenes that I am attempting to build.

I have created the dropdown menu and a script for changing scenes. The script works to change to the second scene by pressing a button in the dropdown menu. I created another almost identical script to change to a third scene and this is where I am running into a problem. Both options in the dropdown menu currently take me to the same scene when clicked.

I currently have both options set up in the “on value changed” area.

How would I go about assigning different scripts to the options in the “values” part of the dropdown menu?

Can anyone point me in the right direction or tell me what I need to do?

If you want to change scenes from the dropdown, 1 option would be to have the method take an int paramter.Then, you can load the scene based on the integer. Just use the same script :slight_smile:

public void ChangeLevel(int level) {
    int levelToLoad = level + 1; // this could be anything. Maybe 1= 4, 2 = 6, 3 = 8 
       // when going from the dropdown to your build index. Or maybe you just need +1 or +2 or maybe
       // you don't need any modification at all :)
    SceneManager.LoadScene(levelToLoad);
   }

There are surely other ways you could do this. Let me know if this sounds good or not to you =)

Thanks for the response! I’ll give this a try and let you know if it works for me. Thanks again! :slight_smile:

Cool :slight_smile: Hope it works for ya.