Search Issue Tracker
By Design
Votes
0
Found in
2017.4
2020.2
Issue ID
1239463
Regression
No
OnDisable and OnDestroy are not called on deleted ScriptableObject
How to reproduce:
1. Open the attached (repro.zip) project
2. In Project Window delete "SO.asset"
3. Check the Console Window
Expected result: "SO.OnDisable" and "SO.OnDestroy" logs appear
Actual result: No logs appear
Reproducible with: 2017.4.40f1, 2018.4.21f1, 2019.3.11f1, 2020.1.0b6, 2020.2.0a8
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
- Multiple warnings are thrown when importing Terrain URP Demo Scene to the Project
- The Frame value field does not update when using the increment/decrement arrows in the Frame Debugger if the value has been manually inputted
- [Remote Config] PreparePayloadWithConfigType function is looking for camelCase property names, when the JSON objects are using PascalCase naming
- UI Builder Viewport's Tool Gizmo has deadzones
- SpriteShapes are rendered using multiple draw calls when the SRP Batcher determines their nodes are incompatible in a specific project
Resolution Note:
After looking into this case I see its expected behavior.
The script does following:
Creates ScriptableObject (SO)
- OnEnable is called
Creates Asset
- Will not call any events, as its only serializing the data.
Attaching that Asset produced to a MonoBehaviour that is added to a scene will invoke all the events as expected.