Search Unity

What is "PhaseCore.TriggerInteractionWork" in the Profiler?

Discussion in 'Physics' started by SomeGuy22, Jul 17, 2019.

  1. SomeGuy22

    SomeGuy22

    Joined:
    Jun 3, 2011
    Posts:
    722
    I've been running profiling tests to improve the performance of my game, and I've discovered something that seems to be hogging an absurd amount of resources. The function in question is called "PhysX.ScNPhaseCore.triggerInteractionWork".



    It's using up 40ms, which seems way too high compared to rest of the items listed there. I have a rough idea where this call is coming from, but I don't know exactly what objects are causing it occur. What's more is that I don't know why it's being made exactly, and why there are 173 calls of it. There's nothing in the documentation that lists what it does, but I'm assuming it has to do with the OnTriggerEnter function; which is strange, because there's already a profiler item for those types of calls under Physics.ProcessReports. It's true that I have many triggers in my scene, but the problem only seems to flare up when a few entities enter just a couple overlapping triggers. I even tried restricting the Physics layer to see if my triggers would ignore some moving parts on the enemies, but it didn't seem to help. Maybe the problem is coming from somewhere else...? But I have no clue where to look since, even in a Deep Profile, there's no information on what objects called it. In the "show related objects" everything is just N/A.

    Does anyone know what this function is supposed to do? How can I track down what's causing it be called so many times? Do I have to just use trial and error to eliminate the possibilities one by one? Thanks in advance!
     
  2. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,327
    the odd thing is that goes up when your camera look at colliders
     
  3. kellyray

    kellyray

    Joined:
    May 18, 2022
    Posts:
    2
    Hey friend, did you ever end up finding the cause of this?
     
  4. SomeGuy22

    SomeGuy22

    Joined:
    Jun 3, 2011
    Posts:
    722
    It's been a while but I believe it must've been some sort of required work done by the physics system when using "isTrigger" on a bunch of colliders. Even though no new trigger events were happening it must be a heavy cost for them to even exist, perhaps because of OnTriggerStay() constantly sending signals.

    I haven't encountered it as an issue as of late, either because newer Unity versions have better physics performance or because my games have different requirements nowadays and don't use as many physics objects. I'm more careful nowadays to not rely on triggers as much by just designing around it.