- Home /
[Custom Editor] MonoBehaviour vs Scriptable Object
I was experimenting with Custom Editors ( following the Adventure game tutorial ) and noticed that if i created a simple editor for a MonoBehaviour that has an array of a base class and it is populated by diferent objects inheriting from that class i can see the Editor on the inspector of each diferent Editor. But if i change the array holder class from MonoBehaviour to ScriptableObject it stops working and objectReferenceValue is always null. why? This portion of code if the class is MonoBehaviour works great, but if it is ScriptableObject it doesnt work!
if( GUILayout.Button("+", GUILayout.Width(200f)))
{
childs.InsertArrayElementAtIndex( childs.arraySize );
childs.GetArrayElementAtIndex(childs.arraySize - 1).objectReferenceValue = ScriptableObject.CreateInstance<ColorNested>();
}
Your answer
Follow this Question
Related Questions
MonoBehavior, ScriptableObject and Object memory usage & performance 0 Answers
Is it possible to write a custom inspector for a script that does not inherit from MonoBehaviour? 0 Answers
Creating a Scriptable Object Custom Editor Footer 0 Answers
base custom editor MonoBehaviour gets overwritten by other custom editors 0 Answers