Hello,
I’m experiencing 2 problems on Unity 2018.1b2 with Jobs and Physx.
-PhysX create many spikes and lags. The scene contains only one FPSController :
I think it’s related to my second problem using Unity.Jobs.
public struct ParrallelGenerateJob : Unity.Jobs.IJobParallelFor
{
public void Execute(int ChunkIndex)
{
DoStuff(); // <----- This function take 20ms maximum
}
}
ParrallelGenerateJob Job = new ParrallelGenerateJob();
GenerateHandle = Job.Schedule(1024 1);
Actually, jobs are executed all in row without switching to other jobs, and create freeze and lags on CPU.
Maybe because other unity systems can(t process. Here is the result :
Also, sometimes it happens (on editor) that a job is executed on the main thread, and i have a timeline showing ParrallelGenerateJob 1000ms on “Main Thread”;
Am i using Jobs correctly or it is a bug that everything is executed in one row without zero chance for other jobs to be executed.
If i use only IJobs, this problem do not appear and jobs are correctly dispatched between other unity jobs.
Thanks.