Hey guys! Total newbie here.
I want to call the index value of a dropdown selection, but I have no idea how to do that. Any thoughts?
Hey guys! Total newbie here.
I want to call the index value of a dropdown selection, but I have no idea how to do that. Any thoughts?
Solved it! Here’s my code, for anyone looking for an easy solution. Add a script with this code to the Dropdown GameObject and assign it and the specific function (“onHerkunftChoose” in my case) to the dropdown OnValueChanged!
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class HerkunftDropDown : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
public void onHerkunftChoose () {
int chosenInt = GameObject.Find ("HerkunftDropdownMenu").GetComponent<Dropdown>().value;
print (chosenInt);
}
}
Just a question, what was your problem that you had? I want to see if i can use it to solve my own problem.