It's hard to give a title for this question, sorry for this.
My situation is this: I have a script that should set a property called "Monsters" (a list) on a given gameobject. This list is composed by a lot of Spawnable, wich is a simple class built in this way:
So the Spawner script that is attached to my "Spawn" empty gameobject (a prefab):
Are there any possibility to do this by allowing unity to automatically generate the editor for my custom type with its base editors? (one for int, one for bool and one for gameobject). Are there any way to set everything I've shown in the inspector?
Thanks for any suggestion I would like to edit through the inspector my monsters list by setting its size (this is already possible) and set Spawnable properties for each item.
Yes, it's very straightforward-
Your 'simple class' shouldn't be descended from MonoBehaviour. The MonoBehaviour class is a complex class with lots of functionality, and it's not really intended to work that way. Instead, just use the 'System.Serializable' attribute, and make it a base class.
Then, when you create your public list, it will give you a sizable dropdown-list with the correct properties for the type.
answered Jan 11 '12 at 09:55 PM
And... what is the answer if I need Spawnable class like Monobehaviour?. I have the same problem and, in my case, I need to detect mouse behaviour over the element. I mean, imagine I have a GUI and a MenuPage and I have a list of controls, basically, this controls are buttons and I have a MenuButtonGUI class for it. Then, like Monster class, I have a MenuPage class to containing a List. When I write a sise in the list I watch a new element in the list but I cannot setup its properties. I have a "class MenuButtonGUIEditor : Editor" too and I tried with it to show and edit the properties of the buttons inside the MenuPage class without success. I have created a "class MenuPageEditor : Editor" to edit the properties of all, the MenuPage class and the properties of elements in the MenuButtonGUI list as well but it seems it's not the way.