Search Unity

(API Change) How to replace ForEachComponentGroupFilter with a non depreciated equivalent?

Discussion in 'Entity Component System' started by Mr-Mechanical, Sep 25, 2018.

  1. Mr-Mechanical

    Mr-Mechanical

    Joined:
    May 31, 2015
    Posts:
    507
    I am in the process of updating the code of my project to be compatible with the new version of ECS. What's the best way to replace the depreciated ForEachComponentGroupFilter ?
     
  2. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    We are using the ArchetypeChunk API in all cases where we used ForEachComponentGroupFilter.

    You could also use ComponentGroup.SetFilter
     
    Mr-Mechanical likes this.
  3. Xerioz

    Xerioz

    Joined:
    Aug 13, 2013
    Posts:
    104
    I encountered the same issue after upgrading, went back to using SetFilter --but out of curiousity, how do we achieve same result using ArchetypeChunk? I tried looking into that but I couldn't figure out how I could properly replace ForEachComponentGroupFilter.
     
    Mr-Mechanical likes this.
  4. dartriminis

    dartriminis

    Joined:
    Feb 3, 2017
    Posts:
    157
    With ArchetypeChunk iteration, since you are iterating at the chunk level, and chunks all have the same shared components, you could just check if that chunk has the appropriate shared component up front.
     
    Mr-Mechanical likes this.