- Home /
Inheritance hierarchy for character class implementation
Hello. So basically I am trying to create a system that for after a certain amount of level ups, a character enters a new tier/class of their choosing.
They start as novice, then at level ten they choose to either be a fighter, a marksman, or a neophyte. They also get a new skillset and their minimum stats increase based on what they choose.
If they choose marskman, then at level twenty they can choose to be rouge, hunter, or sharpshooter.
If they choose rouge, then at level thirty they choose to either be a stealthlade or a skirmisher.
If they choose skirmisher, then at level forty they choose to be a blade dancer or arbiter....
As you can see, this inheritance hierarchy could easily become massive. I was thinking about doing class inheritance, but I don't know if that's feasible longterm. I saw that there are enums and serializible objects I think, but I'm still in the process of learning how they can help me in the future. What do you guys think?
Answer by ShadyProductions · Jun 14, 2020 at 11:21 AM
I'd just make a scriptable object for each class/tier and incorporate the unique skillset into that scriptable object. Then you can assign the scriptable object to the player, that way the player class will know what class it is based on the assigned scriptable object. Any base stats can be part of the player class.
Would this affect Unity's performance? Having too many scriptable objects that is.
It shouldn't affect any performance at all since its not doing any calculations, it's just keeping data. The only thing this affects would be memory usage, but I don't think you need to worry about a few 100 references to data.
Okay, thank you for the reassurance. It's my first time using them so I wasn't sure.
Your answer
![](https://koobas.hobune.stream/wayback/20220613000909im_/https://answers.unity.com/themes/thub/images/avi.jpg)