Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Resolved How to make Ability System in DOTS

Discussion in 'Entity Component System' started by HyunWol, Sep 14, 2022.

  1. HyunWol

    HyunWol

    Joined:
    Jan 27, 2021
    Posts:
    11
    Previously, I used the ScriptableObject.

    Code (CSharp):
    1. public class AbilitySO : ScriptableObject
    2. {
    3.         [SerializeField] TargetingStrategy targetingStrategy;
    4.         [SerializeField] FilterStrategy[] filterStrategies;
    5.         [SerializeField] EffectStrategy[] effectStrategies;
    6.  
    7.         public void Use(GameObject user) { }
    8. }
    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<T>, etc.

    Please give me a good opinion.
     
  2. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,594
  3. WAYNGames

    WAYNGames

    Joined:
    Mar 16, 2019
    Posts:
    944
    Or this one : https://forum.unity.com/threads/dots-skill-system-repo-available.894007/ ;)

    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
    https://forum.unity.com/threads/wil...neric-jobs-going-forward.974187/#post-6373353
    Exemple of generic reactive system.
    https://forum.unity.com/threads/reactive-system-generic-way.919997/#post-6042521
     
    Neiist and Antypodish like this.