I’ve followed every single drop down tutorial available on youtube and through google searches. I follow them step by step, line by line. And literally nothing works. No matter what I do, I can’t get my code to return a value for my drop down lists. It’s always just zero.
The simplest code I followed is essentially:
public class DropDown : MonoBehaviour
{
public void HandleInputData(int val)
{
Debug.Log("val: " + val);
}
}
Assigning HandleInputData to the drop down list’s “On Value Change” simply results a post of “val: 0” to the debug log every time I select a new option in the list when test running the scene. I’ve tried this with a completely fresh scene that had no other elements. Since it is posting to the debug, I know that the drop down list is at least accessing the code there, but no matter what variation of tutorial I’ve followed (some with very different code than the above), they all result in the same return of “0” in all instances.
I’m clearly doing something wrong, but like I said, I’ve literally followed multiple different tutorials multiple different times from scratch, and every time it’s the same result.
Edit: Followed a different tutorial and found the missing element: I needed to assign the drop downs onto the canvas. Apparently the first three tutorials I followed all skipped this step.
