01-03-2025, 12:08 PM
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?
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?