Search Unity

Get Components attached to an Entity from reference to that Entity in a Job

Discussion in 'Entity Component System' started by Whitepot, Mar 22, 2019.

  1. Whitepot

    Whitepot

    Joined:
    May 19, 2017
    Posts:
    15
    In my project, I have entities that only need to change the data on a single other entity.

    The first entity processes some data before passing it to the second one, which process that data and passes it to a third, and so on - in a sort of assembly line fashion.

    Currently, on my first entity I have an Output component. This stores a reference to the second entity, which has an Input component attached to it.

    I haven't tried it, but I seems I could store a reference to the Input component rather than a reference to the second entity itself. The problem is I also need to check if that second entity has other components attached to it (such as a blocked component that stops it accepting input and processing)

    So, while inside a job, is possible to retrieve the components attached to the second entity, just by using a reference to it that is stored in the first entity's Output component?


    .
     
    Deleted User likes this.
  2. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    1,012
    Whitepot likes this.