Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We've updated our Terms of Service. Please read our blog post from Unity CTO and Co-Founder Joachim Ante here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Jobs in FixedUpdate

Discussion in 'Entity Component System and C# Job system' started by jooleanlogic, Jan 10, 2019.

  1. jooleanlogic

    jooleanlogic

    Joined:
    Mar 1, 2018
    Posts:
    115
    When/where is JobHandle.Complete() actually called for all the jobs scheduled in JobComponentSystem.OnUpdate()?
    If I want all my jobs to run within the FixedUpdate cycle, do I need to create a JobComponentSystem to complete these myself or is it enough to tell Unity that this system updates after FixedUpdate?

    Code (CSharp):
    1. [UpdateAfter(UnityEngine.Experimental.PlayerLoop.FixedUpdate)]
    2. class JobSystemA{}
    3.  
    4. [UpdateAfter(SystemA)]
    5. [UpdateAfter(UnityEngine.Experimental.PlayerLoop.FixedUpdate)]
    6. class JobSystemB{}
    7.  
    8. [UpdateAfter(UnityEngine.Experimental.PlayerLoop.FixedUpdate)]
    9. [UpdateAfter(JobSystemB)]
    10. class EndFixedUpdateSystem{
    11.     OnUpdate(JobHandle inputDeps){
    12.         inputDeps.Complete();
    13.         return inputDeps;
    14.     }
    15. }

    Is EndFixedUpdateSystem necessary? My systems are running within FixedUpdate and the jobs are running but I'm not sure if they're running per Update or per FixedUpdate.

    Is the JobHandle passed into OnUpdate() the same handle returned from the previous JobComponentSystem?