#Help fixing dependency error

1 messages · Page 1 of 1 (latest)

slim basin
#

Hi, just can't wrap my head around this error "The system CombatSystem reads Unity.Transforms.LocalTransform via CombatSystem:AttackTargetJob but that type was not assigned to the Dependency property. To ensure correct behavior of other systems, the job or a dependency must be assigned to the Dependency property before returning from the OnUpdate method."

I feel like I went overboard assigning and completing any Dependencies but still get the error.

junior summit
#

Is there a second error log?

slim basin
#

[11:33:24:157] InvalidOperationException: The previously scheduled job CombatSystem:AttackTargetJob writes to the Unity.Entities.EntityCommandBuffer AttackTargetJob.JobData.Ecb. You must call JobHandle.Complete() on the job CombatSystem:AttackTargetJob, before you can write to the Unity.Entities.EntityCommandBuffer safely.
Unity.Entities.WorldUnmanagedImpl+UnmanagedUpdate_00001541$BurstDirectCall.Invoke (System.Void* pSystemState) (at <acf33c246032465d92bd3312165ee605>:0)

#
                                                      TargetTransforms = transforms ,
                                                      TargetEntities   = entities
                                              }.ScheduleParallel( combatNeedTargetQuery, state.Dependency ) ;

            assignHandle.Complete() ;
            
            var attackHandle = new AttackTargetJob {
                                                      Ecb = ecb.AsParallelWriter() ,
                                                      ElapsedTime = SystemAPI.Time.ElapsedTime
                                              }.ScheduleParallel( assignHandle ) ;

            attackHandle.Complete();

            
            var applyDamageHandle = new ApplyDamageJob {
                                                             Ecb = ecb.AsParallelWriter()
                                                     }.ScheduleParallel( attackHandle ) ;

            applyDamageHandle.Complete() ;

            // Dispose of the arrays with the combined handle
            entities.Dispose( assignHandle ) ;
            transforms.Dispose( assignHandle ) ;```
#

works without errors, thanks. But probably overkill on the Completes?