Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

Multi physics scenes in edit mode

Discussion in 'Physics' started by FredZvt81, May 26, 2019.

  1. FredZvt81


    Apr 8, 2014

    If I call SceneManager.CreateScene("My new scene", new CreateSceneParameters(LocalPhysicsMode.Physics2D)) in edit mode it logs an error telling me that this method can only be called in play mode and that I should use EditorSceneManager.NewScene() instead.

    But EditorSceneManager.NewScene() doesn't receives the CreateSceneParameters parameter and I can't find a way to setup the new scene with its own local physics.

    I assumed this was possible because in the documentation for PhysicsScene2D.Simulate it is stated that we can manually simulate physics in edit mode. Is that possible?

    I'm trying to create a tool to predict the physics behavior that my player will have in play mode to support the level designer.

    I'm using Unity 2018.3.14f1.
    Darkgaze and JuozasK like this.
  2. wheaty1995


    Dec 9, 2015
    Having trouble doing a similar thing... Did you ever find a solution?
  3. Darkgaze


    Apr 3, 2017
    Happening in v2019 too. So we basically can't simulate a different physics scene other than the defaultPhysicsScene in Edit Mode. We must simulate all physics.

    Has anybody managed to set the "Physics Scene" manually to a scene created with EditorSceneManager.NewScene?

    I create a scene and an object that has a rigidbody, and I want to simulate it , but only this object in this particular scene. But we can't do this... I'll have to read the code inside the CreateScene method to see what they do...
  4. Darkgaze


    Apr 3, 2017
    I wrote a similar post in the scripting section. Seems like, at least until 2022's docs, this can't be done.

    So this is a feature request. Allow multiphysics scenes in editor, passing a new PhysicsScene, just like with SceneManager.CreateScene... . This can be useful for simulating some objects during edit mode on a separate scene with its own PhysicsScene.Simulate() and avoid simulating the whole scene by calling Physics.Simulate()
  5. Jaimi


    Jan 10, 2009
    So I had this same issue.

    What worked for me was to create a preview scene instead. It appears that by default it has it's own physics:

    Code (CSharp):
    1. #if UNITY_EDITOR
    2.             Scene S = EditorSceneManager.NewPreviewScene();
    3. #else
    4.             Scene S = SceneManager.CreateScene("SmooshScene", csp);
    5.             CreateSceneParameters csp = new CreateSceneParameters(LocalPhysicsMode.Physics3D);
    6. #endif