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?
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.