Search Unity

IJobProcessComponentData for IBufferElementData

Discussion in 'Entity Component System' started by PublicEnumE, Feb 10, 2019.

  1. PublicEnumE

    PublicEnumE

    Joined:
    Feb 3, 2019
    Posts:
    729
    Are there are plans to introduce new "IJobProcess" job types that can support IBufferElementData as generic arguments? Right now I'm using Chunk Iteration.

    Thanks!
     
    Antypodish likes this.
  2. Spy-Shifty

    Spy-Shifty

    Joined:
    May 5, 2011
    Posts:
    546
    You can also use BufferFromEntity<> inside the IJobProcessComponentDataWithEntity
     
    Antypodish likes this.
  3. PublicEnumE

    PublicEnumE

    Joined:
    Feb 3, 2019
    Posts:
    729
    Looking at the source code, it seems like it might be possible to create your own job interfaces, which would auto-populate an "Execute" method however you might like.

    It would be involved, but maybe not impossible. I don't see too much internal stuff being called from IJobProcessComponentData.cs or IJobProcessComponentData.generated.cs.
     
  4. PublicEnumE

    PublicEnumE

    Joined:
    Feb 3, 2019
    Posts:
    729
    Thanks for the suggestion. In this case I'd like to only work on Entities which have a DynamicBuffer of a certain type. I'd like the System's execution to be conditional on those buffers being present, like you can do with a ComponentGroup (or like an IJobProcessComponentData does this).
     
    Last edited: Feb 11, 2019
  5. JooleanLogic

    JooleanLogic

    Joined:
    Mar 1, 2018
    Posts:
    447
    You can add
    [RequireComponentTag(typeof(YourIBufferElementDataType))]
    above the job struct which will then form part of the archetype.
     
    PublicEnumE likes this.
  6. PublicEnumE

    PublicEnumE

    Joined:
    Feb 3, 2019
    Posts:
    729
    Aha. Turns out I didn't know about
    RequireComponentTagAttribute
    . :) Looks like this should do the trick in the meantime.

    Although if anyone has info about plans to add new IJobProcess interfaces with native support for buffers, please drop some knowledge on us. :)