Search Unity

WithSharedComponentFilter version entity

Discussion in 'Entity Component System' started by RoughSpaghetti3211, Feb 22, 2020.

  1. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,708
    I was wondering if someone could help me out. In the snippet of code below im running a job with .WithSharedComponentFilter(id). Is there a way to do this without version the entity. This job should only run once

    Thanks in advance

    Code (CSharp):
    1.  
    2.  
    3. JobHandle sequentialDeps = inputDeps; // Chain job dependencies
    4. foreach (PlanetTagId id  in planetId)
    5. {
    6.    
    7.     JobHandle thisJobHandle = Entities
    8.         .WithSharedComponentFilter(id)
    9.         .ForEach((int entityInQueryIndex, in PlanetTileBiomeComponent b) =>
    10.         {
    11.             Debug.Log(
    12.                 "<b> <size=13> <color=#EA3432>Info : PlanetCreateBiomsSystem : SetDepsSetBioms 1.</color> </size> </b>");
    13.         })
    14.         .WithChangeFilter<PlanetTagId>()
    15.         .WithName("SetDepsSetBioms")
    16.         .WithoutBurst()
    17.         .Schedule(sequentialDeps);
    18.         sequentialDeps = thisJobHandle;
    19. }
    20.  
    21. return sequentialDeps;
    22.  
    23.  
     
  2. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,708
  3. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,708
    In the code below from my understanding if noting changes on TestComponent then the job should not schedual but when ever I used .WithSharedComponentFilter() it trumps my WithChangeFilter()
    Is the a way to WithChangeFilter and WithSharedComponentFilter

    Code (CSharp):
    1.  
    2.  
    3. [LIST=1]
    4. [*]JobHandle sequentialDeps = inputDeps; // Chain job dependencies
    5. [*]foreach (PlanetTagId id  in planetId)
    6. [*]{
    7. [*]  
    8. [*]    JobHandle thisJobHandle = Entities
    9. [*]        .WithSharedComponentFilter(id)
    10. [*]        .ForEach((int entityInQueryIndex, in PlanetTileBiomeComponent b) =>
    11. [*]        {
    12. [*]            Debug.Log(
    13. [*]                "<b> <size=13> <color=#EA3432>Info : PlanetCreateBiomsSystem : SetDepsSetBioms 1.</color> </size> </b>");
    14. [*]        })
    15. [*]        .WithChangeFilter<TestComponent>()
    16. [*]        .WithName("SetDepsSetBioms")
    17. [*]        .WithoutBurst()
    18. [*]        .Schedule(sequentialDeps);
    19. [*]        sequentialDeps = thisJobHandle;
    20. [*]}
    21. [*]
    22.  
    23. [*]return sequentialDeps;
    24. [/LIST]
    25.  
    26.  
     
  4. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,708
    maybe someone can let me know the expected behavior, not not even sure on that