Version: Unity 6.2 (6000.2)
Language : English
Manually set physics simulation
Optimize transform value syncing

Optimize physics for query-only or non-simulating games

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 sceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary
. For example, your game might only require physics queries such as raycasts, spherecasts, or overlap checks, but not RigidbodyA component that allows a GameObject to be affected by simulated gravity and other forces. More info
See in Glossary
components with forces, gravity, or physics-driven movement.

This approach uses physics queries for collisionA collision occurs when the physics engine detects that the colliders of two GameObjects make contact or overlap, when at least one has a Rigidbody component and is in motion. More info
See in Glossary
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:

  • Physics queries still function by checking against the physics world’s representation of collidersAn invisible shape that is used to handle physical collisions for an object. A collider doesn’t need to be exactly the same shape as the object’s mesh - a rough approximation is often more efficient and indistinguishable in gameplay. More info
    See in Glossary
    .
  • If you have objects in your scene that are moved by directly manipulating their Transform components, their positions within the physics engineA system that simulates aspects of physical systems so that objects can accelerate correctly and be affected by collisions, gravity and other forces. More info
    See in Glossary
    ’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).
  • To ensure raycasts and other queries against these colliders are accurate, assuming 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 GameObjectsThe fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info
    See in Glossary
    that have colliders.
  • If 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.
  • Without an explicit 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:

  1. Select Edit > Project Settings to open the Project Settings window.
  2. Select the Physics > Settings tab.
  3. Select the GameObject tab.
  4. Set Simulation Mode to Script.

To disable automatic simulation in script, set Physics.simulationMode = SimulationMode.Script; at runtime.

Additional resources

Manually set physics simulation
Optimize transform value syncing