Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

The hybrid approach in current DOTS

Discussion in 'Entity Component System' 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:
    259
    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:
    3,753
    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:
    851
    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:
    3,753
    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:
    3,753
    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!