Search Issue Tracker

Won't Fix

Votes

0

Found in

2021.3.30f1

2022.3.9f1

2023.1.13f1

2023.2.0b9

2023.3.0a5

Issue ID

UUM-48997

Regression

No

Prefab assets get edited in Play mode via a script without referencing them when they are selected in the Project window

--

-

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)

  1. Resolution Note:

    Thank you for reporting a bug to Unity.

    We have reviewed the issue carefully, and in this case, the team is unable to prioritize fixing this bug. There are a number of reasons we make this decision, including the impact and severity of the issue across our user and customer base, and the possibility that future plans may solve the problem in a different way, or that a workaround for the bug may be available.

    Today we will be closing this case. Thank you again for taking the time to report this issue, and please let us know if there is anything else that changes the impact or severity of this issue.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.