Reproduction steps:
1. Open the attached "benchmark-tdd-asteroids" project
2. Open "Assets/Scenes/02_Options" scene
3. In the Hierarchy window, expand the "MenuBase" GameObject and click on the "OptionsMenu" GameObject
4. In the Inspector window, disable the "UI Document" Component
5. Observe the Console Logs to see that no errors were thrown
6. Enable the "UI Document" Component
7. Enter and exit the Play Mode
8. Disable the "UI Document" Component
9. Observe the Console Logs
Expected results: The "Destroy may not be called from edit mode! Use DestroyImmediate instead." error is not thrown
Actual results: The "Destroy may not be called from edit mode! Use DestroyImmediate instead." error is thrown
Reproducible with: 2023.2.0a21, 2023.2.7f1, 2023.3.0b4
Not reproducible with: 2021.3.34f1, 2022.3.18f1, 2023.2.0a20
Reproducible on: Windows 11 Pro, MacOS 14.1 (user's)
Not reproducible on: No other environments tested
Notes:
- The error is not thrown when disabling the UI Document Component in Play Mode
- The error is also thrown upon entering the Play Mode for the second time and subsequently
- Reproducible in Standalone Player by simply doing "Build and Run"