Flexible ability system

I am trying to implement aflexible ability system for my game. I have multiple different playable Character, and they each need to have their own collection of different abilities. The current setup i have for Abilities is as follow :
AbilityBase : ScriptableObject :
This contains all basic infos related to each ability, such as cooldown, type, icon sprite, etc…

abstract Ability: Monobehaviour:
This is an abstract class that contains code for common behaviour across all abilities, such as cooldown changes, and an abstract Activate method that each different ability script will override with their own code. This script also has an AbilityBase variable.

AbilityName : Ability
Finally, i have multiple different ability scripts, each inheriting from the abstact ability class and implementing their own Activate method.

The problem i am running into with this structure is that in the editor, i cannot put individual abilities in my character’s ability collections. In my character script i have a public List, But the editor does not let me put my individual ability scripts inheriting from Ability in that list. I am a bit lost on how to achieve this system.

Thanks !

Are you trying to drag in the script assets? They’re just text files.

You’d need to drag in a component instance in a scene, or one that is on the root game object of a prefab.

There may be some handy nuggest in this:

ScriptableObject usage in RPGs:

Usage as a shared common data container:

I didn’t think about instantiating every Ability script in the editor. However, since every ability can only be assigned to one character, and there might be many many abilities, It could create a lot of additionnal clutter in my scene. Is this common/good practice ?

Honestly none of this stuff should live in scenes. I would keep all the data pertaining to abilities to scriptable object asset land, and then these scriptable objects can be used to define the abilities of any given character.

If they need to have state that gets updated during gameplay, then the scriptable objects can act as a factory for some kind of runtime instance.

My current usage of scriptable objects seems to be in line with what this suggests. My problem mostly lies in how each character should store their abilties monobehaviors. Each ability has it’s own runtime script, I just dont know how to make a nice generalized, decoupled way of storing multiple abilities in one Character, without having to hardcode which ability goes on which character

Personally, I would just have Abilities as C# classes with properties and logic functions. Then on your character script (the one attached to the model) had a List (or a dictionary that you could use an AbilityType enum to find a specific ability). That would be used store them and be able to call the functions to execute whatever that ability is. To prevent hard coding of the abilities within the character script you can use a JSON text file that has the configuration of each character then you can load this when a Character is Instantiation and instantiate each ability using reflection and store it in the ability list of the character.

Hope that helps and makes sense.