I was playing around a bit with creating asset lists and I noticed a curious behaviour that I wanted to understand a bit better.
I have:
[System.Serializable]
public class SpawnItemList : ScriptableObject {
public List itemList;
}
Originally, I made GameItem a scriptable object as well. When I created the asset using AssetDatabase.CreateAsset, I noticed that Unity allows me to expand the asset list, however it does not let me populate the items (in the Editor). Instead, I get a bunch of placeholders for GameItem, set to null.
However, if I make GameItem a simple data container that does not extend ScriptableObject, then Unity instantiates the object, allowing me to enter in the data for GameItem.
Why the difference?
↧