Possible To Prevent Base Classes From Being Selectable When Serializing Subclass For Editor?

I’ve come across a situation where I have two different scriptable object types serialized in the same class and because one inherits from the other as so,

public class BaseArmorType : BaseResistanceState
public class BaseResistanceState : ScriptableObject

When I click on the object that is of BaseResistanceState type, I am given the option of selecting BaseArmorType objects as that object in the editor.

[SerializeField]
protected BaseArmorType m_ArmorType;
[SerializeField]
protected BaseResistanceState m_ResistanceState;

Is there a way to prevent this? I not only find it kind of bothersome, but the BaseArmorType class has a different function that is used when processing damage and if it were to be the one selected it would bypass the armor functionality and purely process it as a BaseResistanceState. But mostly, it’s bothersome. So much so, if there is no way, I will probably use two different class types. Simply to avoid the possibility.

Thanks in advanced.

Uhm, that’s how inheritance works and no, you can not prevent this without some custom editor scripts. Note that your “BaseArmorType” actually IS a “BaseResistanceState”. That’s what the inheritance actually means, So your BaseArmorType is just a specialization of your BaseResistanceState class, but it still is one. Just like we humans are still great apes as any decended species still belongs to parent species and that will never change.

So if your BaseArmorType actually is not a BaseResistanceState, it should not be derived from that class.