How to make Ability System in DOTS

Previously, I used the ScriptableObject.

public class AbilitySO : ScriptableObject
{
        [SerializeField] TargetingStrategy targetingStrategy;
        [SerializeField] FilterStrategy[] filterStrategies;
        [SerializeField] EffectStrategy[] effectStrategies;

        public void Use(GameObject user) { }
}

First, I use the Sriptableobject in IComponentdata.
But ScriptableObject managed type.
Therefore, it is not accessible from Jobs.

Second, I use Interface.
However, I cannot use Interface as a T parameter in places such as SystemBase.HasComponent, etc.

Please give me a good opinion.

I suggest you are use search DOTS forum, as we have discussed that in few instances.

Search for skills, and ability keywords:
https://forum.unity.com/search/16069877/?page=2&q=Ability&t=post&o=date&c[node]=147+583+641+422+425

https://forum.unity.com/search/16069910/?q=Skills&t=post&o=date&c[node]=147+583+641+422+425

Two threads you may find for example, are:

If you dig more, you will find more solutions and discussions.

1 Like

Or this one : DOTS skill system repo available :wink:

Based on your post, you mays also be interested in learning about BlobAsset, that’s what I use to convert my scriptable ability to entity world (sigleton entity).

Also about interface you may want to have alook at generic systems/jobs, relevent ressources :
Talk about the additionnal requirement for generic job/systems

Exemple of generic reactive system.

2 Likes