Search Unity

Feedback Pure ECS vs Conversion

Discussion in 'Entity Component System' started by BitPax, Dec 10, 2020.

  1. BitPax

    BitPax

    Joined:
    Oct 4, 2019
    Posts:
    89
    Which way provides better performance and is recommended? Any pitfalls to keep in mind?
     
  2. thelebaron

    thelebaron

    Joined:
    Jun 2, 2013
    Posts:
    857
    "pure" ecs results from conversion. conversion is not meant to happen during gameplay. it simply converts authoring(gameobject) data into runtime(entity) data.
     
    PublicEnumE likes this.
  3. PublicEnumE

    PublicEnumE

    Joined:
    Feb 3, 2019
    Posts:
    729
    via Subscenes.
     
  4. BitPax

    BitPax

    Joined:
    Oct 4, 2019
    Posts:
    89
    Ah, I see what you mean. What I meant was is it better to write all the code in the ECS way even when creating entities or attach the corresponding gameObject with a convertToEntity utility script (or use subscenes). It seems there's usually extra left over MonoBehaviour components that aren't necessarily needed when using conversion. I was wondering what the recommended process was.
     
    Last edited: Dec 10, 2020
  5. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    4,270
    You can clean some of this up using a custom GameObjectConversionSystem. But you are right. The conversion process is not as clean or as controllable as it needs to be. This is an area in DOTS still under heavy development. It still is a significantly better workflow than constructing entities through code though.
     
  6. thelebaron

    thelebaron

    Joined:
    Jun 2, 2013
    Posts:
    857
    Easiest way is to just use conversion as it is. Unity themselves recommend using conversion, they are investing heavily into making it the defacto way to use dots. Once you start running into specific issues you can dive into creating entities manually, but conversion will allow you to have a faster head start into using dots.
    Manually creating entities is not difficult per se but there will be a lot of learning as a beginner into just the new api's and tossing in manual entity creation into that mix is really something that isn't necessary for starting out(plus you will figure it out just by learning the ins and outs of entities).
    Though I cant say I'm as advanced as some of the other users here, I've been using dots for a while and I lean heavily into conversion for 95% of the time.

    Use it and if you run into issues where conversion isnt working out for you, post about it. Unity needs this sort of feedback.
     
  7. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,778
    Go to entity conversion is convenient, when mesh and shaders are involved.
    You are provided with neccesery components in entity. Any extra you can remove after conversion.

    What I do, if using conversion, I use these as base prefab, then add required additional components to entity prefabs. After that I instantiate if needed, to create variant prefabs and add relevant components. Now I can use these to runtime instantiation.

    If entities does not require mesh, I tend to create archetype for them and use it as prefab.
     
    JesOb likes this.
  8. Lieene-Guo

    Lieene-Guo

    Joined:
    Aug 20, 2013
    Posts:
    547