- Home /
Why child ScriptableObjects class instance cannot be placed in their parent ScriptableObject field in the inspector?
Why child ScriptableObjects class cannot be placed in their parent ScriptableObject field in the inspector, but the MonoBehaviors can be placed?
If I have a child and parent class, one inheriting from MonoBehavior and the other one from ScriptableObject
public class MonoParentClass : MonoBehaviour
{
}
public class MonoChildClass : MonoParentClass
{
}
public class ScriptableParentClass : ScriptableObject
{
}
[CreateAssetMenu(...)]
public class ScriptableChildClass : ScriptableParentClass
{
}
I can create two fields for the childs like this :
I can put the MonoChild Prefab with no problem, but I can't put the ScriptableObject child without specifically creating a field ScriptableChildClass scriptableChildClass. Why does it works with the monobehavior child prefab but not with the scriptableobject child instance? Is there another way around it? I'm still learning unity, thanks!
Answer by Quest_for_stuff · Sep 06, 2021 at 10:33 PM
Nevermind, it's just because I wrote the class ScriptableChildClass inside ScriptableParentClass.cs but I had to create the file ScriptableChildClass.cs and put the class in there so they have the same name.
Your answer
Follow this Question
Related Questions
Adding inherited class to list 1 Answer
Can you allow inhereted ScripableObjects to be linked in the editor without dragging and dropping. 0 Answers
How Are You Resetting Your Scriptable Objects Between Play Tests? 3 Answers
Memory usage of Sprites in a referenced Scriptable Object 0 Answers
Is it possible to create game object/prefab from file? 2 Answers