I’m working on a game with a variety of different units and skills, and skills are given to units in the following manner:
Skills are custom components, with “Skill” as a base class that inherits from Custom Component, which is inherited by “PassiveSkill”, “TargetedSkill”, etc. blueprints, which are then inherited by actual skills that are placed on units such as “Attack”.
“TargetedSkill” handles much of the functionality that is shared between different skills, such as the range, power, and cost of the skill, whether it needs line of sight, if it has area of effect, etc.
I then place one of the skills (Let’s use Attack as the example) onto a unit as a component. I then customize the skill by changing the default values on the component - Instead of 1 damage it does 3 damage; the max range is set from 1 to 2, the name of the skill is set to “Spear” and so on. Everything works great up to this point.
If I decide that I wanted to add a new variable to the parent class “Skill”, some but not all of the customized values of the “Attack” component will reset to the default properties of “Attack”. The max range might be reset to 1, and the custom name of the skill might revert from “Spear” back to “Attack”, although the attack will still do 3 damage. There does not seem to be an obvious pattern as to which variables will revert back to default.