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. Dismiss Notice

Bug [Case 1395158] Moving objects between scenes with LocalPhysicsMode toggles their active state

Discussion in 'Editor & General Support' started by CDF, Jan 14, 2022.

  1. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,269
    I really hope this isn't by design. But when loading/creating scenes using any LocalPhysicsMode, when moving game objects between these scenes they are disabled then re-enabled.

    This is different when using LocalPhysicsMode.None, where you can move objects between scenes without them being disabled/enabled.

    Can see the issue here. These scenes are loaded/created using LocalPhysicsMode.3D
    When pressing spacebar, the "TestMove" object is moved to the next scene.
    "TestMove" object contains a component that listens to "OnEnable" and "OnDisable"

    qirv4rPoE7.gif

    Here's the same setup using LocalPhysicsMode.None:

    WLNPxvdCzS.gif

    The "TestMove" object is a simple gameObject (No physics) with a simple script:

    Code (CSharp):
    1. public class TestSceneMove : MonoBehaviour {
    2.  
    3.     private void OnEnable() {
    4.  
    5.         Debug.Log("OnEnable, gameObject active: " + gameObject.activeSelf);
    6.     }
    7.  
    8.     private void OnDisable() {
    9.  
    10.         Debug.Log("OnDisable, gameObject active: " + gameObject.activeSelf);
    11.     }
    12. }
    This is surely a bug right?