How to add custom inherited classes to array and edit them in the Inspector

I am attempting to make a card system in which each card is a scriptable object instance with a list of effects that are carried out when the card is played. I have the following effect classes so far:

[System.Serializable]
public class CardEffect {}

[System.Serializable]
public class EarnGoldEffect
{
    public int amount;
}

[System.Serializable]
public class StealGoldEffect
{
    public int amount;
    public bool giveToThief;
}

This is my scriptable object class:

public class Card : ScriptableObject
{
    public string cardName;
    public string description;

    public CardEffect[] activeEffects;
    public CardEffect[] passiveEffects;
}

I want to be able to add effects to the active and passive effect arrays on the card and edit their properties in the inspector, but when I add a new effect to the array it is blank with no way for me to edit it. Is there any way to make this work without having to make a custom inspector editor script that has to accommodate every future card effect. I am probably missing something basic but I am not sure how I could set this up.

First, in order to support polymorphism, you need to Serialize a Reference. This lets unity remember the type of each instance as well as its data, among other things.

This alone won’t give you any way how to create different CardEffect derived class instances in the inspector, only how to serialize them. You will need to create a tool / property drawer that lets you do that, eg. by showing a button that shows a popup menu with all available types.