How to use Physics.autoSyncTransforms in unity?

I am a beginner developer. I have been studying the unity physics system recently. Because I have to do a lot of optimization about the physical system, I paid attention to these two apis, but I don’t know what the specifics are and how to use them. Thank you?

Perhaps I am not familiar with your specific use case but how in the world do you expect Unity’s physics feature to be unable to handle your simulation/game with the Job System and ECS already in place?

I added a collider to an object but didn’t add a rigidbody. Now I want to move this object through transform, will it cause performance consumption? So I need to study Physics.autoSyncTransforms

Been there, done that, don’t do it. Add a rigidbody and things will be much easier. Moving transforms is not only inefficient and bad practice, but you will have to implement your own physics layer (which includes a headache I mean collision handling). Even if you have a collider it will not affect the object in the way I think you think it will.

2 Likes

Objects with a collider that do not have a rigidbody should not be moved. You will get performance issues, unreliable physics interactions, and unexpected results. See the manual:

1 Like

Thank you very much, you are right, but because there are a lot of GameObjects, if you add Rigidbody, will it consume performance? I am very confused now.

Thank you very much, I am stupid, but because I have a lot of GameObjects, if I add a rigid experience, it will not cause performance consumption? Thank you very much for your answer.

Well any component you add will have some performance impact, as it is more code that will need to run. Unity has done their best to limit the performance impact of individual rigidbodies of course. I’d suggest profiling your game before, then add rigidbodies and check the profiler again to see if the hit is significant. If you’re just talking about a handful of objects you will probably not see much if any.

The information in the manual is outdated. Starting around Unity 5 (PhysX 3.3) moving static colliders causes no penalties anymore. If you just need colliders without Rigidbody, then there’s no need to use it.