Reproduction steps:
1. Open the attached “IN-54175 Prefab Asset Bug.zip“ project
2. Open the “SampleScene”
3. Select the “Prifabus 1” Prefab in the Project window
4. Observe the Positions of the GameObjects nested under the “Prifabus 1” in the Preview window
5. Enter Play mode
6. Left-click on the Game view
7. Repeat the 4th step
Expected result: The GameObjects' Positions have not changed
Actual result: The GameObjects' Positions have changed
Reproducible with: 2021.3.30f1, 2022.3.9f1, 2023.1.13f1, 2023.2.0b9, 2023.3.0a5
Reproduced on: Windows 11 Pro (22H2)
Not reproduced on: No other environment tested
Notes:
- The changes made to the Prefab assets persist after exiting Play mode
- If multiple Prefab assets are selected, all of them get edited at the same time
- The GameObjects that are in the Prefab asset itself get changed separately from the Prefab instance in the scene (the Prefab asset gets edited even without having an instance of the Prefab in the scene)
- The Prefab instance gets set to the state of the asset after exiting Play mode
- To reload the scene while in Play mode, right-click on the Game view
- To exit the Player, press the “escape” key
- Reproducible in a new project
- Not reproducible in the Player (the GameObjects' Positions are the same every time the Player is launched or the scene is reloaded)
- If a Prefab asset is selected in the Project window when reloading the scene, a MissingReferenceException gets displayed in the Console after left-clicking on the Game view twice
Full error message:
MissingReferenceException: The object of type 'UnityEngine.Transform' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
UnityEngine.Object+MarshalledUnityObject.TryThrowEditorNullExceptionObject (UnityEngine.Object unityObj, System.String parameterName) (at <e7dcd36961eb4de08bd0c4dd0320a488>:0)
UnityEngine.Bindings.ThrowHelper.ThrowNullReferenceException (System.Object obj) (at <e7dcd36961eb4de08bd0c4dd0320a488>:0)
UnityEngine.Transform.get_rotation () (at <e7dcd36961eb4de08bd0c4dd0320a488>:0)
Scrambler.Scramble () (at Assets/Scrambler.cs:78)
Scrambler.Update () (at Assets/Scrambler.cs:57)