Set parameters via GUI.Textfield

Is it possible to set a number in a GUI.textbox that will act as a parameter (I.E a number of game objects to instantiate)?

Code would be appreciated, but is not obligatory; Just help me find an anwser. :smile:

By the way, hello friendly Uniteers, I hope our collaboration will be sucessful!

Not sure if I really understand what you need, but if you mean “Can I use a numeric value in a GUI.Textfield” then the answer is yes.

Just:

//GUI code

valueToSet = int.Parse(GUILayout.TextField(valueToSet.ToString()));

//when instantiating
for(int i = 0; i < valueToSet; i++)
{
GameObject go = Instantiate(yourPrefab, position, rotation) as GameObject;
}

How this answers your question.

This is exactly what I need!

With your help, my project can continue!

Thanks alot! :smile: