Search Unity

Which ECB should delete colliders? Should I set up dependencies to the commandbuffer systems myself?

Discussion in 'Physics for ECS' started by cultureulterior, Jul 6, 2020.

  1. cultureulterior

    cultureulterior

    Joined:
    Mar 15, 2015
    Posts:
    68
    Right now I have a physics system setting up lots of physics queries (sheduled between StepPhysicsWorld and EndFramePhysicsSystem which I think is right (there's no documentation)).

    I then have a parallel system which sometimes deletes a collider using the EndSimulationEntityCommandBufferSystem. It throws errors in the console, and I'm wondering if the CommandBufferSystems that execute (when they execute) have the proper dependencies between the physics systems set up allowing them to do that or if I should create my own CommandBufferSystem that has the proper dependencies?
     
  2. petarmHavok

    petarmHavok

    Joined:
    Nov 20, 2018
    Posts:
    461
    I think EndSimulationEntityCommandBufferSystem has what it takes. The question is whether your system runs at the time you specified, or it is just scheduled in that order. Please use AddInputDependency on EndFramePhysicsSystem to make sure it waits for your query job before it executes. That should do the trick.
     
    cultureulterior likes this.