Right now I'm developing a game that requires enemies to spawn at specific times.
To simplify this process, I have sort of a "spawning manifest", which contains 3 different public arrays. The first lets me choose a prefab, the second lets me pick what time each enemy is spawned, and the third tells it where to spawn.
However, enemies of all different types will need to be spawned (and they have numerous variables, such as firing rate, movement speed, etc.). Will I need to make a prefab of every tiny variation, or is there some way to access (in the editor) a GameObject's components/values while it is displayed inside of an array?
For instance, in the Inspector I unfold the "Enemies" array, add one to the list, and I can see all of its editable values much like if I selected the prefab directly?
If not, this doesn't bode well and I'll have to scrap my entire spawning system, and unfortunately I don't know what else to do in its stead except place every enemy by hand.
asked Aug 16 '11 at 04:18 AM
The easiest way to do this is to create a custom inspector. you should start with: http://unity3d.com/support/documentation/Components/gui-ExtendingEditor.html here is an example of building custom arrays: http://answers.unity3d.com/questions/26207/how-can-i-recreate-the-array-inspector-element-for.html what you would need to do is add some stuff to expand each array element in a similar manner.
answered Aug 16 '11 at 05:16 AM
Sounds like your structure dependencies are backwards, since you don't want the variables in the prefab GameObject, yet you have them there. I would suggest that you move those variables you mention to an EnemyData class that is just a structure of the variables. You then have a single array of these. When an object is spawned, the prefab is instantiated, and a