Search Unity

Setting up the ECS in Unity

Discussion in 'Entity Component System' started by Garzec, May 13, 2018.

  1. Garzec

    Garzec

    Joined:
    Mar 3, 2016
    Posts:
    151
    Hi,
    I want to learn how to setup the Entity Component System in Unity. I don't want to use Entitas because I want to do it on my own.

    When searching for tutorials I always get these information:

    Enitity
    A gameobject that holds all the components

    Component
    Just a datastore with no logic

    System
    This holds the logic for the components.

    But I can't figure out how to setup the project. I would create a `PositionComponent`

    Code (CSharp):
    1.     public class PositionComponent
    2.     {
    3.         public int X {get; set;}
    4.         public int Y {get; set;}
    5.         public int Z {get; set;}
    6.     }
    and what would I have to do now?

    - How do I add this component to the entity?

    - How do I manage all the enitities?

    - How do I have to setup the system?

    I get explanations what the ECS is but I don't get how it works. There is no simple example out there. It would be awesome if there was something like converting this tutorial

    https://unity3d.com/de/learn/tutorials/s/roll-ball-tutorial

    into a ECS based tutorial.
     
  2. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    838
  3. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Moved over.
     
  4. Prastiwar

    Prastiwar

    Joined:
    Jul 29, 2017
    Posts:
    125