Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
using UnityEngine;
using UnityEngine.SceneManagement;
public class CreateScene : MonoBehaviour
[SerializeField] string sceneName = "SubScene";
[SerializeField] Collider groundCollider;
[SerializeField] GameObject moveGameObject;
private PhysicsScene physicsScene;
[Range(0.1f, 5)]
float speed = 1;
void Start()
Scene scene = SceneManager.CreateScene(sceneName, new CreateSceneParameters(LocalPhysicsMode.Physics3D));
physicsScene = scene.GetPhysicsScene();
// 地面を移植して、指定したGameObjectを指定シーンへ移動させる
SceneManager.MoveGameObjectToScene(Instantiate(groundCollider.gameObject), scene);
SceneManager.MoveGameObjectToScene(moveGameObject, scene);
private void FixedUpdate()
physicsScene.Simulate(Time.fixedDeltaTime * speed);

This comment has been minimized.

Copy link
Owner Author

tsubaki commented Nov 19, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.