30-03-2021, 09:37 AM
(This post was last modified: 30-03-2021, 09:43 AM by josemendez.)
(30-03-2021, 09:30 AM)sdpgames Wrote: Hi!
When I have a fluid simulation and enable/disable an ObiCollider it's incredibly slow for a few frames (the game can be stuck 3 seconds in the editor. Less bad on device but still bad). I nailed it to the fact that every change in collider structure requires some sort of mega flush to Oni. It does the same when creating ObiRigidbodies at runtime, destroying ObiColliders at run-time etc
It makes the game unusable in pretty random instances, is there anything we can do?
We are using Oni backend, Unity 2019.4.22f1, Obi Fluid 6.0.1. Tested on both Mac (editor) and iOS (on both SE and SE 2020, iPhone 11), same result every time.
Please help thanks!
Hi there,
I'm unable to reproduce this. Enabling or disabling a collider should only affect that individual collider, there's no "mega flush" of any kind taking place.
What is done when creating (or activating) a collider is just appending its data to a collider list. When removing (or deactivating) a collider, its data is swapped with the last entry in the collider list, and the list size reduced by 1. So both operations have a O(1) cost, should be extremely cheap. The collider list (as well as the rigidbodies list) are memory mapped, so passing them to Oni just copies a pointer, not the entire list. You can check the implementation in ObiColliderWorld.cs.
- How many colliders are there in the scene?
- What kinds of colliders are we talking about? (primitives, or meshcolliders/distance fields?)
- Could you share a profiler screenshot showing this performance drop you're describing?
kind regards