Adding inherited class to list

Hi
I have 4 classes that work together as follows

BSpell (contains all functions for generic spells

SpellProperties : BSpell (each spell will have its own such as "fireballProperties, this contains all the detail information such as damage ect)

SpellMechanics : SpellProperties (contains mechanics of spell, used on a gameobject prefab)

PlayerClass

This is where my problem comes in, in PlayerClass i have a public List spellBook.
i would like to add the different SpellProperties to this list (through code),
but if BSpell inherits from mono then a new instance cannot be instantiated.
if BSpell inherits from ScriptableObject then SpellMechanics cannot affect its gameobject.

Any help would be appreciated

Your notation is a little vague. You say each spell “has a” spellProperties object which keeps track of information such as damage, etc, but the notation “SpellProperties:BSpell” indicates spellProperties inherits from BSpell.(if this distinction dose not make sense, look into “has a” vs “is a”)

I will answer your question for each case:

Lets say your character has three scripts attached to him, say FireBall, MagicMissil, and ConeOfCold.

If each of these spells “is a” SpellProperties (if they inherit from it), then just use

spellbook.add(gameobject.getcomponent<fireball>());

If each of these spells “has a” SpellProperties (if each one has a spell properties as an element to keep track of various stats), then use this

spellbook.add(gameobject.getcomponent<fireball>().fireballProperties);

For each other “spell” you would just use its name instead of “fireball”.

if you want to add a new spell to the player, just use addcomponent().