Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Using multiple SubtractiveComponents, is it logical AND or logical OR?

Discussion in 'Entity Component System' started by volvis, Jun 29, 2018.

  1. volvis

    volvis

    Joined:
    Jan 10, 2013
    Posts:
    11
    With a setup like this

    Code (CSharp):
    1. struct Data {
    2.    public ComponentDataArray<A> m_a;
    3.    public SubtractiveComponent<B> m_b;
    4.    public SubtractiveComponent<C> m_c;
    5. }
    Does this skip entities that have both B and C but allow combinations of A&B and A&C? Or does this mean that the given entities will not have B nor C?
     
  2. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    1,554
    Everything is logical AND it must not have both B and C
     
  3. volvis

    volvis

    Joined:
    Jan 10, 2013
    Posts:
    11
    So if I understand this correctly, it will skip entities that have ABC but it may include combinations of A, AB and AC?
     
  4. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    1,554
    The entity with only A will be injected because the requirement says it must have A.
    The entity with AB will not be injected because the requirement says it must not have B.
    The entity with AC will not be injected because the requirement says it must not have C.

    So you can think that everything in the struct is a "must"