Search Unity

The hybrid approach in current DOTS

Discussion in 'Data Oriented Technology Stack' started by Nesvi, Sep 12, 2019.

  1. Nesvi

    Nesvi

    Joined:
    Jan 26, 2013
    Posts:
    14
    Hi!

    Is the hybrid approach still a thing in current DOTS version? I've some tests made using 2018.3 and previous versions of the official samples included an hybrid version.

    Thank you in advance!
     
  2. desertGhost_

    desertGhost_

    Joined:
    Apr 12, 2018
    Posts:
    74
    DOTS currently lacks some features, e.g. animation, which will need to be done with a hybrid approach.
     
  3. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    1,667
    If you haven't used the entities package in a while Hybrid entities have changed a bit. GameObjectEntity is now depreciated and replaced by the conversion system (with injection for hybrid)
     
  4. thelebaron

    thelebaron

    Joined:
    Jun 2, 2013
    Posts:
    277
    Which(the conversion system) fyi still has the same or better functionality at the end of the day, just going about it in a different way.
     
  5. Nesvi

    Nesvi

    Joined:
    Jan 26, 2013
    Posts:
    14
    I started with that conversion system, but I would like to reference CharacterController for example. I had no issues with that in the previous version. I may be missing something, but documentation seems pretty arduous/confusing now.
     
  6. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    1,667
    Add a CharacterController and ConvertToEntity scripts to a gameobject.
    Select the inject option on the ConvertToEntity script.

    Done, entity created, character controller added as a component.
     
  7. Nesvi

    Nesvi

    Joined:
    Jan 26, 2013
    Posts:
    14
    That sounds great!

    How do I access that component after the inject option? Do we have examples of this usage?
     
  8. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    1,667
    EntityManager.GetComponentObject<CharacterController>(Entity)

    or

    this.Entities.ForEach((CharacterController controller) => {})

    (could be a syntax error though, from memory)
     
  9. Nesvi

    Nesvi

    Joined:
    Jan 26, 2013
    Posts:
    14
    Okey, this works, this is neat. Thank you for solving me this!