Prevent the default physics update loop from running to reduce unnecessary performance overhead by changing the Simulation Mode to Script.
Preventing the default physics update loop from running can be beneficial if your game doesn’t require physics simulation for the default physics scene. For example, your game might only require physics queries such as raycasts, spherecasts, or overlap checks, but not Rigidbody components with forces, gravity, or physics-driven movement.
This approach uses physics queries for collision detection or environmental interaction without the performance cost of a full physics simulation, and it maintains control over when transform data is synchronized.
Note the following if you set the Simulation Mode of the default scene to Script:
Transform components, their positions within the physics engine’s internal spatial data structures are not automatically updated to match their Transform positions frame-to-frame (since no simulation step is occurring by default in this mode).Physics.autoSyncTransforms is false (its default and recommended setting), you must manually call Physics.SyncTransforms once per frame before performing your queries. This function explicitly updates the physics system with the current state of all the transform values of__ GameObjects__Unity 场景中的基础对象,可以表示角色、道具、风景、摄像机、路径点等。GameObject 的功能由所附的组件决定。更多信息Physics.autoSyncTransforms is set to true, this synchronization happens implicitly before each query, but this is generally not the recommended best practice for the potential overhead of syncing before every query. Note that Physics.autoSyncTransforms is deprecated. To learn how to sync transforms, refer to Optimize transform value syncing.Physics.SyncTransforms call (when autoSyncTransforms is false), queries might use outdated object positions and lead to incorrect results.To prevent the default physics update from running in the Editor:
To disable automatic simulation in script, set Physics.simulationMode = SimulationMode.Script; at runtime.