Wanna choose how many items create in editor C#

Hi, following to that tutorial

I’ve got:

public class MakeItems {
[MenuItem("Assets/Create/Myobject")]
	public static void CreateMyObj()
{
//stuff inside
}

//To create multiple sctiptable object I'm using for loop:

[MenuItem("Assets/Create/Create 5 objects")]
	public static void CreateFive()
	{
		for (int i = 0; i < 5; i++) {
            CreateMyObj();
		}
	}
}

My question is: how to choose manually how many objects to create? For example after click “Create 5 objects” button, be able to write from keyboard?

Change the “5” for a variable. And then you can put the value you whant in the variable and it will create the objects.

public class MakeItems {

public int howManyItemsToSpawn = 5;

 [MenuItem("Assets/Create/Myobject")]
     public static void CreateMyObj()
 {
 //stuff inside
 }
 //To create multiple sctiptable object I'm using for loop:
 [MenuItem("Assets/Create/Create 5 objects")]
     public static void CreateFive()
     {
         for (int i = 0; i < howManyItemsToSpawn; i++) {
             CreateMyObj();
         }
     }
 }

You can then edit the “howManyItemsToSpawn” variable.