Search Unity

Preparing for ECS

Discussion in 'Scripting' started by RoughSpaghetti3211, Mar 22, 2018.

  1. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,709
    Hello,

    I’ve been following the ECS progress reading up on all the Unity updates. My question is, being new to the ECS way of thinking how can I prepare myself for when it lands. What can I do with my current game code to ensure I’m able to rewrite it over as painlessly as possible. Any additional reading tutorials would be appreciated

    Thanks in advance
     
  2. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,038
    The official documentation sort of exists, and is linked from one of the stickies in the ECS forum:
    https://forum.unity.com/forums/entity-component-system-and-c-job-system.147/

    By "sort of" I mean that it's not finished. The tutorial has barely gotten past the intro, for example :)

    What's there should explain the difference nicely though, and there is a little example showing how to do things the ECS way instead of the MonoBehaviour way.
     
  3. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,709
    Cool thanks for the reply, I did check out all the doc and example in there. I guess Im more asking how should I write code going forward in anticipation for ECS.
     
  4. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,038
    I guess the answer is very carefully, checking with every new beta if they broke something again :p

    Derive from IComponentData to hold your internal variables. Derive from JobComponentSystem as described to do the equivalent of Update(). The rest is a bit scattered and unclear. I've decided to wait for another beta release personally, both to get better tutorials and for them to remove the need for all these helper objects. There's also basically no interaction with the editor right now, which is why you'd still be using occasional MonoBehaviours to hold data.