Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

ICollisionEventsJob executed in one thread only?

Discussion in 'Physics for ECS' started by kro11, Apr 25, 2021.

  1. kro11

    kro11

    Joined:
    Sep 23, 2019
    Posts:
    91
    Does ICollisionEventsJob executed in one thread only? Is there a way to handle collisions in parallel?
     
  2. petarmHavok

    petarmHavok

    Joined:
    Nov 20, 2018
    Posts:
    461
    Unfortunately right now it's only single threaded. If you look at Simulation.CollisionEvents, you could iterate through them once and store them in a structure that then helps you parallelize work on them. However, that would only pay off if you have really heavy work on each of the events. If it's really simple, it'll probably be slower that way.
     
    kro11 likes this.