Search Unity

Job.ScheduleSingle vs Job.Run

Discussion in 'Entity Component System' started by Jay-Pavlina, Jan 21, 2019.

  1. Jay-Pavlina

    Jay-Pavlina

    Joined:
    Feb 19, 2012
    Posts:
    195
    If I am doing work in a system that does not require multiple threads, is it more efficient to use Job.ScheduleSingle in a JobComponentSystem, or should I use Job.Run in a ComponentSystem?
     
  2. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,761
    ScheduleSingle will still run the code in a seperate thread that's (usually) not the main so it's going to be more efficient. It's just only run on a single thread instead of splitting it over multiple.

    So yeah you should use ScheduleSingle. I think run should only really be used for debugging purposes.
     
    Jay-Pavlina likes this.