Search Issue Tracker
In Progress
Fixed in 2022.3.15f1, 2023.2.1f1, 2023.3.0a13
Fix In Review for 7000.0.0a1
Votes
0
Found in
2022.3.3f1
2023.1.1f1
2023.2.0a20
7000.0.0a1
Issue ID
UUM-40624
Regression
Yes
Crash on UndoManager::RegisterUndo when attaching a script with MonoBehaviour.Reset() function that changes the GameObject's properties
Reproduction steps:
1. Open the attached project “CrashRepro“
2. Drag ”Assets/NewScript.cs” on “TestingObject“ in the Hierarchy window
Expected result: Script gets added to “TestingObject“ or an error is thrown
Actual result: Editor crashes
Reproducible with: 2022.1.0a12, 2022.3.3f1, 2023.1.1f1, 2023.2.0a20
Not reproducible with: 2021.3.27f1, 2022.1.0a11 - “Can’t add script 'NewScript' to the GameObject 'TestingObject' because it has destroyed itself in Awake or OnEnable“ window appears
Reproducible on: Windows 10
First few lines of Stack Trace:
{noformat}0x00007ff68c29c146 (Unity) UndoManager::RegisterUndo
0x00007ff68c27c603 (Unity) PostAddComponentUndo
0x00007ff68c27735e (Unity) AddComponentUndoable
0x00007ff68bd796df (Unity) AddDefaultComponent
0x00007ff68bd79849 (Unity) AddDefaultComponent
0x00007ff68c1371b6 (Unity) AddComponentMenu::AddComponentToGameObjects{noformat}
Note: Editor does not crash and throws an error when resetting the attached script component from 2022.2.0a3 and above
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Color picker does not show the correct color when selecting color on the moving object
- “Asset X has no meta file, but it's in an immutable folder. The asset will be ignored.” errors are thrown when importing package with files not listed in package.json's "files" property
- There is no way to adjust the HDR Paper White value of the Unity Editor's interface, making it difficult/uncomfortable for some developers to work on very dark/bright scenes in HDR
- Animator window has a dropdown button that throws “MissingReferenceException” error on a new project when the previous project had a GameObject with an animation
- Animator State name overflows outside the visual box when the State has a long name
Resolution Note (fix version 2023.3.0a13):
Added detection within AddComponent of scripts that potentially destroy the object during Reset.
Resolution Note (fix version 2023.2.1f1):
Added detection within AddComponent of scripts that potentially destroy the object during Reset.