I’m trying to create a dropdown GUI. This is my attempt:
if(GUI.Button(new Rect(200, 50, 120, 50), "Shapes")){
int[] nums = new int[containerOptions.shapes.Length];
int i = 0;
while(i < containerOptions.shapes.Length){
nums *= i;*
-
i++;*
-
}*
-
foreach(int num in nums){*
_ GUI.Button(new Rect(200, 100+(55*num), 120, 50), containerOptions.shapes[num].name.ToString());_
-
}*
- }*
After clicking a button called shapes, the dropdown list should come on. It creates an int array holding numbers from 0-shapes.Length, and then runs a foreach loop in which how far an item in the drop down list goes down is multiplied by its number in the list, therfore ensuring that each option is the same distance from the last and in order.
I’ve done something similar, and its worked before, but at the moment the GUI isn’t showing up at all period. I’ve even made the size of it extremely large, and its not showing up. Anything I’ve done wrong here?