Search Unity

JobCompositonSystem and inputdeps

Discussion in 'Entity Component System' started by sebas77, Aug 21, 2019.

  1. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,642
    if I have a JobComponentSystem called BuildPhysicWorld that returns

    Code (CSharp):
    1. return JobHandle.CombineDependencies(FinalJobHandle, inputDeps);
    and then I have a system like

    Code (CSharp):
    1. [UpdateAfter(typeof(BuildPhysicsWorld)), UpdateBefore(typeof(EndFramePhysicsSystem))]
    2. class CharacterEnvironmentCollisionSystem : JobComponentSystem
    would I need this:

    Code (CSharp):
    1. protected override JobHandle OnUpdate(JobHandle inputDeps)
    2. {
    3. inputDeps = JobHandle.CombineDependencies(inputDeps, _buildPhysicsWorldSystem.FinalJobHandle);
    to be sure that the job will be scheduled after the job from BuildPhysicWorld or it should be not necessary? I am not sure if the previous handle is passed somehow inside the next inputdeps and in this case I wouldn't need to do it, but it's just gut filling, the related code is not simple to follow.
     
  2. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,759
    The dependency system should handle it fine without having to manually handle the dependencies yourself (which is the primary point of the system really) as long as you use the system and aren't sharing containers etc outside of it.
     
    sebas77 likes this.
  3. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,642
    thank you very much tertle!!