#Using the same NetworkDriver.Concurrent in two Jobs causes an error

1 messages · Page 1 of 1 (latest)

velvet aspen
#

I am working on a Unity Transport + Jobs server system for my game that has the layout of:

recieve netcode packets -> turn them to game events -> parallel execution of systems -> send back events from each system

Problem is that I keep getting an error:

InvalidOperationException: The previously scheduled job CalculateWorkerVisibilityJob writes to the Unity.Collections.NativeArray`1[System.Int32] CalculateWorkerVisibilityJob.driver.m_PendingBeginSend. You are trying to schedule a new job CalculateMinionVisibilityJob, which writes to the same Unity.Collections.NativeArray`1[System.Int32] (via CalculateMinionVisibilityJob.driver.m_PendingBeginSend). To guarantee safety, you must include CalculateWorkerVisibilityJob as a dependency of the newly scheduled job.

But this makes no sense because I use the NetworkDriver.Concurrent that I get using NetworkDriver.ToConcurrent().

#

Code:

// Calculate game object visibility and send packets if needed (pov possibly changed since last update) TODO: possibly move data flip into here

// TODO: Add "executeSectorBehavior_Handle" dependency because even workers and minions need sector updates to be done properly (claimed tile visibility update)
JobHandle executeBehavior_CombinedHandle = JobHandle.CombineDependencies(executeWorkerBehavior_Handle, executeMinionBehavior_Handle);

// Calculate worker visibility
CalculateWorkerVisibilityJob calculateWorkerVisibility_Job = new CalculateWorkerVisibilityJob(netcode.ConcurrentDriver);
JobHandle calculateWorkerVisibility_Handle = calculateWorkerVisibility_Job.Schedule(256, 32, executeBehavior_CombinedHandle);

// Calculate minion visibility
CalculateMinionVisibilityJob calculateMinionVisibility_Job = new CalculateMinionVisibilityJob(netcode.ConcurrentDriver);
JobHandle calculateMinionVisibility_Handle = calculateMinionVisibility_Job.Schedule(256, 32, executeBehavior_CombinedHandle); // <- ERROR HERE
            
// Calculate sector visibility
CalculateSectorVisibilityJob calculateSectorVisibility_Job = new CalculateSectorVisibilityJob(netcode.ConcurrentDriver);
JobHandle calculateSectorVisibility_Handle = calculateSectorVisibility_Job.Schedule(256*256, 64, JobHandle.CombineDependencies(executeSectorBehavior_Handle, executeBehavior_CombinedHandle));
velvet aspen
#

bump

silk scaffold
#

I don't use UTP directly. But sounds like ToConcurrent() is just making a copy of NetworkDriver.Concurrent so i think you might need to get a new Concurrent for each job

velvet aspen
silk scaffold
#

I would maybe post this on the forums if you haven't already. The team is bit more active there. Or a support ticket.