I've noticed recently that calling Body.SetActive() in my game is getting expensive - expensive enough that it is causing visible delays.
Doing some digging, I think I understand why. My scene is composed of a large number (thousands) of static objects - mostly edges. Box2D handles the scene very well - it scales beautifully with the complexity of the scene. Unfortunately, it looks like a
side effect of the structures used to make things scale nicely make it expensive to modify large scenes on the fly.
I'm going to look into modifying the code to see if setting the body's Active flag without doing the other aspects of deactivating it works - if so, I can always have it in the simulation, but flip it's active bit at will.
Interestingly, only activating a body seems to be expensive - SetActive(false) is no problem.
Any suggestions on things that I can try without having to maintain forked code would be much appreciated.