I attached the following script to an empty game object (EnemiesGO) in the editor.
public class EnemiesScript {
[System.Serializable]
public struct EnemyWithType {
public EnemyScript enemy;
public EnemyScript.Type enemyType;
}
public EnemyWithType[] enemyPrefabs;
public EnemyScript[] enemies;
void Start ()
{
enemies = new EnemyScript[enemyPrefabs.Length];
for (int i = 0; i < enemyPrefabs.Length; i++)
{
enemies[i] = Instantiate<EnemyScript>(enemyPrefabs[i].enemy);
enemies[i].enemyCategory = enemyPrefabs[i].enemyType;
}
}
}
When I was populating enemyPrefabs (through the editor) I didn't see the prefabs in the popup selection window so I dragged them directly from the Assets window Assets/Resources/Prefabs/EnemyPrefabs. My question is two fold.
- If it is possible, how can I get the populated
enemyPrefabsarray to be displayed in the game window/ scene window before I run the game? In general, I would like to see changes effected from the editor in the game window before I run the game. - How can I access the EnemyPrefabs folder from the popup selection window?