protected override JobHandle OnUpdate(JobHandle inputDeps) { if (m_Requests == null || m_Requests.Count == 0) { return(inputDeps); } inputDeps = JobHandle.CombineDependencies(inputDeps, m_BuildPhysicsWorldSystem.FinalJobHandle); JobHandle combinedJobs = inputDeps; for (int i = 0; i < m_Requests.Count; i++) { JobHandle rcj = new RaycastJob { Results = m_Results[0].PixelData, Request = m_Requests[0], World = m_BuildPhysicsWorldSystem.PhysicsWorld.CollisionWorld, NumDynamicBodies = m_BuildPhysicsWorldSystem.PhysicsWorld.NumDynamicBodies }.Schedule(m_Results[0].PixelData.ForEachCount, 1, inputDeps); rcj.Complete(); //<todo.eoin How can we properly wait on this task when reading results? combinedJobs = JobHandle.CombineDependencies(combinedJobs, rcj); } m_Requests.Clear(); m_Results.Clear(); return(combinedJobs); }
protected override void OnUpdate() { if (m_Requests == null || m_Requests.Count == 0) { return; } var handle = JobHandle.CombineDependencies(Dependency, m_BuildPhysicsWorldSystem.GetOutputDependency()); JobHandle combinedJobs = handle; for (int i = 0; i < m_Requests.Count; i++) { JobHandle rcj = new RaycastJob { Results = m_Results[0].PixelData.AsWriter(), Request = m_Requests[0], World = m_BuildPhysicsWorldSystem.PhysicsWorld.CollisionWorld, NumDynamicBodies = m_BuildPhysicsWorldSystem.PhysicsWorld.NumDynamicBodies }.Schedule(m_Results[0].PixelData.ForEachCount, 1, handle); rcj.Complete(); //<todo.eoin How can we properly wait on this task when reading results? combinedJobs = JobHandle.CombineDependencies(combinedJobs, rcj); } m_Requests.Clear(); m_Results.Clear(); Dependency = combinedJobs; }