Description
Scope used during scene load operations such as SceneManager.LoadSceneAsync, with the purpose of providing a different physics scene than the global one.
<![CDATA[
using UnityEngine;
using UnityEngine.SceneManagement;
public class SimpleLoader : MonoBehaviour
{
IEnumerator Start()
{
int buildIndex0 = 0;
int buildIndex1 = 1;
var newScene = SceneManagement.SceneManager.LoadScene(buildIndex0, new LoadSceneParameters() { localPhysicsMode = LocalPhysicsMode.Physics3D });
var localPhys = newScene.GetPhysicsScene();
using(new PhysicsSceneLoadScope(localPhys))
{
SceneManagement.SceneManager.LoadSceneAsync(buildIndex1);
}
}
}
]]>