- Home /
Register derived classes with manager class before instantiation
I have an abstract Spell
class. Each spell the player can cast inherits from that Spell
class, like Spell_Fireball : Spell
.
I have a SpellManager
class that should know about every spell. Since spells are just prefabs until they're cast, how can I make them register themselves with the SpellManager
before instantiation?
My initial plan was to just have List<Spell>
and then assign each spell prefab in the inspector, but I forgot Unity doesn't support serialising derived classes. Maybe I'm thinking about this the wrong way but I'm a bit stuck.
Your answer
Follow this Question
Related Questions
Having issues getting player to damage multiple enemies 0 Answers
Instantiate method cause conversioning derived class to be base class on component variable. 0 Answers
gun manager how to 2 Answers
How to get variables from other Scripts on trigger enter? 1 Answer
Why I cant use 2 NetworkManagers in the same time? 0 Answers