I am comparing the cost of an Physics.OverlapCapsuleNonAlloc in 2017.1f3 and 2017.2b2, and the latter takes about 4x more milliseconds than the former.
I’ve noticed this performance difference seems to apply to pretty much all physics calls. My guess is that it’s related to the new Physics.autoSyncTransforms feature?
Anyway, since this is a beta, I’m not really complaining. I’m just mentioning this out of curiosity in case you guys have more information on autoSyncTransforms and if that performance hit is normal.
Yes, all the queries have an automatic sync point to make sure the hierarchies are synced between Unity and the physics engine. I don’t think there should be more cost to it.
That said, one way to see the numbers you report would be to change a number of physics-related transforms and the then call a query. That query would have to apply the changes before proceeding, and that will take time (only in autoSyncTransforms=true mode though). I’d like to note that this cost was there before, as part of transform.position / transform.rotation setter. It’s just that now it’s concentrated around one call instead of being all over the place.
Now, if you think this doesn’t sound like what you’re doing, please file a bug, we’ll take a look.
I have to say I didn’t test in a build, which I probably should try. But I’ll file a bug if it’s still a problem
Also, I’m wondering if that extra cost is maybe only due to the fact that the profiler now has to display an entry for every “sync” call, and it didn’t have to do that before
Please file a bug on the Editor issue you’re having anyway. If you feel you’d like to do some more testing, you’re free to provide us with more info at a later time!