[1.0.8] Force ServerWorld to run all systems on main thread config

Regarding this issue ( [1.0.8] ServerWorld at editor become slower and slower ), maybe it’s good have an config option to force ServerWorld to run all systems on main thread meaning IJobEntity.ScheduleRef() or Parallel will force to become IJobEntity.RunRef() at ServerWorld to get better performance at editor. This config is also able to bring to actual player runtime build. I think currently there’s cmd parameter command to pass in to force to run on main thread but I’m not whether it provides the same main thread performance with set all systems to IJobEntity.RunRef(). Btw I also would like to know what’s cmd parameter command to pass in to force to run player runtime on main thread.

In case anyone is curious: You can limit the number of worker threads available to the JobSystem itself via Unity - Scripting API: Unity.Jobs.LowLevel.Unsafe.JobsUtility.JobWorkerCount (which I would recommend doing in the cases where job scheduling overhead is significantly worse than the job itself, or you wish to force Unity to be singlethreaded).

We do have plans to allow more job scheduling configuration going forward, similar to the DOTS Physics package (where you can add a PhysicsStep component to a sub-scene, and disable job threads for all Physics subsystems).

And in editor, you can test with Preferences > Jobs > Use Job Threads: untick.

1 Like