I’m noticing that after a GameObject is moved to another scene with a new physics scene that the Monobehaviours attached to the given GameObjects call their Awake() functions again.
Is this intended behavior?
I’m noticing that after a GameObject is moved to another scene with a new physics scene that the Monobehaviours attached to the given GameObjects call their Awake() functions again.
Is this intended behavior?
I just noticed this is actually not the case.
This bug is actually singled out to an AudioSource playOnAwake field being true.
That is if you tell an audio source to play on awake and you move the gameobject with that audio source to a new physics scene it will play the audio again.
If you can replicate that failure in a tiny micro project, that is EXACTLY the kind of bug Unity wants to see and can easily fix.
Help → Report A Bug…
You know the drill.
Yup @Kurt-Dekker that’s exactly what I did. Thanks for calling it out!
This isn’t a bug, it’s also not controlled by 2D/3D physics itself but the scene-management stuff. To ensure that all the backend physics objects are destroyed in the old scene, the GameObject is deactivated then, when the GameObject is in the new scene, it’s activated and any backend physics objects are created in the correct physics world.
There is no other way to move the backend stuff.
AFAIK if it’s a different local physics world then it’ll recreated it.