Search Issue Tracker
Duplicate
Votes
14
Found in
2019.4
2020.3
2021.3
2021.3.2f1
2022.1
2022.2
Issue ID
1426900
Regression
No
Error "Destroy may not be called from edit mode! Use DestroyImmediate instead." is shown when exiting Play Mode
How to reproduce:
1. Open the attached project "UIToolTip"
2. Click Play
3. Click Play again to exit Play Mode
4. Observe the Console
Expected result: Console shows no errors
Actual result: Console shows "Destroy may not be called from edit mode! Use DestroyImmediate instead." error
Reproduced in: 2019.4.38f1, 2020.3.33f1, 2021.3.1f1, 2022.1.0b16, 2022.2.0a15
Reproduced on: Windows 11 Pro
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
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
sugiharam2
Mar 10, 2024 03:47
When I tried downgrading the InputSystem version, the error disappeared.
Unity 2023.2.13f1
Input System 1.7.0 > error
Input System 1.6.3 > error
Input System 1.5.0 > no error
Don't use Input System > no error
berber_hunter
Dec 29, 2023 17:24
This is not resolved!!!!
Pchan_Cegepdefi
Dec 11, 2022 07:31
[Solution] I had the same problem. I double clicked on the error message and the script "EventSystem.cs" opened at line #413. The error said "Use DestroyImmediate instead". So I replace the line "panel.destroyed += () => Destroy(go);" TO "panel.destroyed += () => DestroyImmediate(go);"
bilalakil
Oct 03, 2022 00:00
Also looking for the duplicate ticket so I can vote on it. Note that this bug prevents some build attempts from succeeding.
generatedgoblin
Aug 12, 2022 13:10
Can't find the duplicate, can this be re-opened?
severeZzz
Jun 14, 2022 17:35
Could you please add a link to the original ticket? "Duplicate" is not informative.