Search Issue Tracker
OnAfterDeserialize is not called when disabling domain reload and scene reload
How to reproduce:
1. Open attached project "case_1252121-bugreport.zip"
2. Open "SampleScene" Scene
3. Enter Play Mode
4. Observe the error message thrown in the Console window
Expected result: reference to a Prefab remains unchanged
Actual result: reference to a Prefab becomes null
Reproducible with: 2019.3.0a1, 2019.4.0f1, 2020.1.0b13, 2020.2.0a15
Not reproducible with: 2018.4.23f1, 2019.2.21f1
MissingReferenceException: The object of type 'Character' 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.
Assets > Data > CharacterSet has two references attached as seen in the Inspector window under the "Data" dropdown. "CharacterSet.cs" script contains the OnValidate method, in which a Debug.Log prints if the object exists or not. After entering Play Mode, the elements of "Data" become null and a script recompile is needed to fix the issue.
Any domain reload will fix this issue. Closing the project and nuking the Library folder will make it re-appear.
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
- OnActiveBuildTargetChanged is not called when changing the build platform
- Silent crash when scripts are recompiled on a specific project
- [Android] Video freezes when built for Android with specific project
- UI element is not displayed when Canvas Render Mode is set to Screen Space-Overlay
- Editor crashes on libetc_init when changing WebGL Texture Format to "RGB + 1-bit Alpha Compressed ETC2 4 bits"