Multi-Scene Physics
Tutorial
·
intermediate
·
+10XP
·
20 mins
·
(141)
Unity Technologies

Previously, Unity had one physics Scene that was populated with all the bodies and colliders from all of your Unity Scenes. Starting in Unity 2018 LTS, you can split physics across Scenes.
In this tutorial, you'll learn the basics of creating and loading alternate physics Scenes that can overlay a main scene.
Languages available:
1. Benefits of Multi-Scene Physics
The PhysX 3.4 upgrade in Unity 2018 LTS allows you to create multiple physics Scenes. With PhysX3.4, you can specify whether a given Unity Scene uses the default physics Scene or its own local one, for both 2D and 3D physics.
Previously, Unity had one physics Scene that was populated with all the bodies and colliders from all of your Unity Scenes. There are particular cases where this is limiting, and having physics split across Scenes allows you to do a number of different things. For example, you can simulate Scenes using PhysicsScene.Simulate on any frequency (think multiple parts of your world simulated with different frequencies). Another example is creating an invisible physics Scene to predict trajectories.
2. Creating a Separate Physics Scene
Follow these steps to set up and configure two separate physics Scenes using a custom script.
- Create two new Scenes (Project window > Create > Scene). Name the Scenes MainScene and AlternateScene.
- In MainScene, add a Plane object (GameObject > 3D Object > Plane). Center its position to (0, 0, 0), and change the rotation to (5, 0, 0).
- Add a Sphere object (GameObject > 3D Object > Sphere) and position it above the plane at the top end (Figure 01).

Figure 01: MainScene with plane and sphere
- Add a Rigidbody component to the sphere (Component > Physics > Rigidbody).
- Run the Scene and observe the sphere rolling down the plane and then falling off the plane.
- In AlternateScene, set up an identical simulation, but set the rotation of the plane to (-5, 0, 0), and remove any lights and cameras from the Scene.
- Open the File > Build Settings window, and add both of your Scenes here, with MainScene being index 0 (Figure 02). The first Scene in the list is always the one Unity loads when the application starts.

Figure 02: Two Scenes in the build
Now we have two independent Scenes, each containing a simple physics simulation.
3. Adding Code to Load the Second Scene
From the first Scene, we need to add code to load the second Scene in such a way that the two Scenes will have their own physics simulation.
- Create a new script file (Project window > Create > C# script) and name it PhysicsSceneLoader. Copy and paste the following code into the file.
- In MainScene, create a new empty GameObject and add a PhysicsSceneLoader component to it. In the component options, add the name AlternateScene in the Physics Scene Name field.
- Press Play and observe how each sphere rolls down its own plane and does not interact with any objects in the other Scene.
- Modify the value of PhysicsSceneTimeScale to adjust the simulation speed of the alternate Scene.
Now we have two intersecting physics Scenes that are completely independent of each other. Where they would normally collide, they instead don’t interact at all.
4. Multi-Scene Physics Tips
When writing code dealing with physics and physics Scenes, note the following:
- In order for a physics Scene to be independent, it must be loaded with the parameter that makes it independent. It can’t be done after the Scene has been loaded or dynamically created. This is demonstrated in Start(), in the code example.
- A Scene that’s loaded this way will not auto-simulate. Because of this, you should manually call Simulate() on the physics Scene. You can get the physics Scene from the Scene object. This is demonstrated in FixedUpdate(), in the code example.
- Any raycasts or shapecasts using Physics.Raycast, etc., will not interact with objects in a local physics Scene. Instead, update your code to use the casting methods on the physicsScene object. This will also work for a Scene that was not loaded with an independent physics Scene.
These are just a few things to keep in mind when using this new feature.
Multi-Scene Physics opens up many new possibilities, such as trajectory simulations for shooter games, or ghost effects in which colliders apply only to objects and characters in one Scene.