#How to scheduled a EntityJob with EnabledRefRW<Tag> correctely?

1 messages · Page 1 of 1 (latest)

torn zodiac
#

In my EntityJob, after using EnabledRefRW<DeadTag>, I encountered an error:

InvalidOperationException: The previously scheduled job SetVisualPositionSystem:SetTransform reads from the ComponentTypeHandle<Common.DeadTag> SetTransform.safety. You are trying to schedule a new job BulletHitSystem:HitJob, which writes to the same ComponentTypeHandle<Common.DeadTag> (via HitJob.JobData.__TypeHandle.__Common_DeadTag_RW_ComponentTypeHandle). To guarantee safety, you must include SetVisualPositionSystem:SetTransform as a dependency of the newly scheduled job.

It seems to be a scheduling issue. How should I correctly set the dependencies for this EntityJob that uses EnabledRefRW<Tag>?

winged night
#

show code

torn zodiac
#

this is the error job.

winged night
#

What matters is how you are scheduling htem

torn zodiac
#

just new HitJob
{
HitLookup = _hitLookup,
Partial = singleton,
}.ScheduleParallel();

#

and new SetTransform
{
Delta = SystemAPI.Time.DeltaTime,
}.ScheduleParallel();

#

they are in different systems.

winged night
#

you've likely missed up a job handle

#

but without showing the full code of both systems can't really spot it

#

OH wait

#

no i think you've run into the WithNone bug

#

ok WithNone doesn't add a dependency to a system

#

i've reported it to Unity here

#

change your WithNone(typeof(DeadTag)) to WithDisabled(typeof(DeadTag))

#

alternatively, if it hsould be withnone (handle both case of not existing and being disabled) add a dependency into the system manually

#

something like
state.GetComponentTypeHandle<DeadTag>();
in OnCreate to work around the bug

torn zodiac