private void FixedUpdate() { updateParticles.dt = Time.fixedDeltaTime; applyRelaxation.dt = Time.fixedDeltaTime; colliderInteraction.dt = Time.fixedDeltaTime; var updateHandle = updateParticles.Schedule(waterState.x.Length, 256); for (var i = 0; i < gridInfo.xCells * gridInfo.yCells; i += 1) { grid[i * gridInfo.cellSpace] = 0; } var colliderMovement = new NativeArray <float2>(colliders.Length, Allocator.TempJob); var accumulated = 0; for (var i = 0; i < colliders.Length; i++) { var collider = colliders[i]; var pos = ((float3)collider.transform.position).xy; colliderMovement[i] = pos - oldColliderPositions[i]; oldColliderPositions[i] = pos; for (var j = 0; j < collidersPointsNum[i]; j++) { var point = collider.transform.TransformPoint(collider.points[j]); collidersPoints[accumulated + j] = new float2(point.x, point.y); } accumulated += collidersPointsNum[i]; } colliderInteraction.colliderTranslation = colliderMovement; updateHandle.Complete(); // Need update to complete first gridSort.Schedule(waterState.x.Length, 256).Complete(); updatePressures.Schedule(waterState.x.Length, 256).Complete(); applyRelaxation.Schedule(waterState.x.Length, 256).Complete(); colliderInteraction.Schedule(waterState.x.Length, 256).Complete(); colliderMovement.Dispose(); waterDisplay.UpdateDisplay(waterState.x, waterState.y); }