Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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

Discussion in 'NetCode for ECS' started by optimise, May 17, 2023.

  1. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,114
    Regarding this issue (https://forum.unity.com/threads/1-0-8-serverworld-at-editor-become-slower-and-slower.1437445/), 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.
     
  2. NikiWalker

    NikiWalker

    Unity Technologies

    Joined:
    May 18, 2021
    Posts:
    306
    In case anyone is curious: You can limit the number of worker threads available to the JobSystem itself via https://docs.unity3d.com/ScriptReference/Unity.Jobs.LowLevel.Unsafe.JobsUtility.JobWorkerCount.html (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
    .
     
    Kmsxkuse likes this.