Ok so heres the solution.
I had to re do my generate function, will explain further down,
i then went to my ui and added an image
then added a input field
then added a button
then added a label
This created the “How many box”
which i then disabled
in my script i added:
public GameObject howManyPopUp;
private InputField HowManyIn;
then dragged my new “image” into the new slot in my script
in void start i added
HowManyIn = howManyPopUp.GetComponent();
Then when a player hits generate my program checks to see if multi generate is set to true, if it is not then it calls my generate function and passes the times value of 1 (ie generate once)
If however it is true then it simply enables the How Many dialog window with :
howManyPopUp.SetActive(true);
and then it sits there all smug, its job is done after all
the player sees the window and assumes the code is still running, and enters a numeric value of how many times (limited to 3 characters so they can not go crazy!)
and when they hit the “ok button” this code is run :
public void multiGenerate()
{
int times = 1;
string Generator = spinner.options[spinner.value].text;
try
{
times = int.Parse(HowManyIn.text);
}
catch (System.Exception)
{
times = 10;
}
doGenerate(Generator, times);
howManyPopUp.SetActive(false);
}
as you can see i check to see if they have entered non numbers in the box and fix it if they have.
Most assuredly the worst way i have ever seen to implement popup windows in coding but im guessing there is an easier way that i just do not know about (or i did it wrong) but hey the code works! horses mouth, not looking, etc etc
(hopefully the solution i used will help the next person googling the issue, though it should be noted i have no idea if this is the “right” way)
EDIT
Actually its not working, its always generating 10 so something is going wrong with parsing the int from the Input Field…rats!