Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Performance degradation when using Collision callbacks in scripts
#1
Hello. I am using the latest Obi Fluid 7 with Unity 2022.3.43f1.

I noticed that when running a script with the following code while the Backend mode of the Obi Solver is set to GPU, performance deteriorates. Regardless of the processing inside the Solver_OnCollision function, simply registering a function as an event listener to .OnCollision causes a performance drop.

Example:
void OnEnable()
{
    if (solver != null)
    {
        solver.OnCollision += Solver_OnCollision;
    }
}

void OnDisable()
{
    if (solver != null)
    {
        solver.OnCollision -= Solver_OnCollision;
    }
}

private void Solver_OnCollision(object sender, ObiNativeContactList e)
{

}
However, when the Backend mode is set to CPU, the impact on performance is minimal.

Why does this happen?
Is there a way to use GPU Backend mode without causing a performance drop while still using this script?
Reply


Messages In This Thread
Performance degradation when using Collision callbacks in scripts - by Cat3Man - 01-03-2025, 12:08 PM