Search Unity

Any chance of IJobProcessEntity

Discussion in 'Entity Component System' started by tertle, Oct 15, 2018.

  1. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,759
    Any chance of a IJobProcessComponentDataWithEntity that takes no componentData and instead just uses optional tag components.
    I'd call it, IJobProcessEntity.

    Example of current code that could use it.

    Code (CSharp):
    1.  
    2.         [RequireComponentTag(typeof(OverheadCamera), typeof(VirtualCameraBaseTargets))]
    3.         [RequireSubtractiveComponent(typeof(Initialized))]
    4.         private struct SetupCameraAssignmentJob : IJobProcessComponentDataWithEntity<OverheadCamera>
    5.         {
    6.             public EntityArchetype Archetype;
    7.             public EntityCommandBuffer.Concurrent CommandBuffer;
    8.  
    9.             public void Execute(Entity entity, int index, ref OverheadCamera _)
    10.             {
    11.                 CommandBuffer.AddComponent(index, entity, new Initialized());
    12.                 CommandBuffer.CreateEntity(index, Archetype);
    13.                 CommandBuffer.SetComponent(index, new AssignTarget{Target = entity});
    14.             }
    15.         }
    16.  
    The OverheadCamera isn't required at all, it just needs to be tag but I have to assign it anyway.
     
    S_Darkwell, rigidbuddy and recursive like this.
  2. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    I'll file a bug for making zero variant for IJobProcessComponentDataWithEntity