- Home /
Custom editor for class containing classes
Hey everyone,
I have a MonoBehaviour that I want to create a custom editor for, example:
public class SomeObject : MonoBehaviour
{
public MetaDataObject Obj1, Obj2, Obj3;
}
public class MetaDataObject
{
int SomeData;
string MoreData;
}
Now, how can I edit the Obj1/2/3 inside SomeObject using the custom editor feature?
Thanks!
Answer by Paulius-Liekis · Nov 14, 2012 at 05:07 PM
Add [System.Serializable] attribute to MetaDataObject class definition and you will be able to edit it with default inspector.
Thanks that works! However, is it possible to add a custom editor to edit the fields of those SomeObject.Obj1/2/3?
Answer by jarenas · Mar 27, 2013 at 04:06 PM
hi,
And how could I do the same if MetaDataObject class inherits from Monobehaviour?
Regards, Jordi
Again, please DO NOT post questions as a solution to someone else's problem. Post your own question and refer to the other questions or Comment on the answer.
Your answer
Follow this Question
Related Questions
Initialising List array for use in a custom Editor 1 Answer
Create Spells through classes in custom editor? 1 Answer
Multiple Cars not working 1 Answer
Prefabs aren't saving with Undo.RecordObject 4 Answers
Distribute terrain in zones 3 Answers