Search Issue Tracker

Won't Fix

Votes

0

Found in

2017.4.0f1

2018.2.5f1

2018.3.0a1

2019.1.0a1

Issue ID

1096889

Regression

No

ISerializationCallback.OnBeforeSerialize sometimes fail to access a reference to ScriptableObject asset

Scripting

-

How to reproduce:
1. Open the user-submitted project ("iserializationcallback_scriptableobject_bug.zip")
2. Observe the console errors (Enter and leave Play mode if the errors are not present)
3. Try to rename one of the non-accessible Scriptable Assets and enter Play Mode again
4. Observe that their name/path hasn't updated in the error message
5. Build and run the Player (As a development build) and observe that the paths are updated and no errors are thrown

Expected result: All of the assets get referenced correctly and no errors are thrown
Actual result: Some of the assets don't get referenced correctly and throw errors in Editor only

Reproduced in: 2019.1.0a12, 2018.3.1f1, 2017.4.17f1

Note: The Scriptable assets that return null when referenced are not always the same and differ from version to version

  1. Resolution Note:

    Unity APIs should not be accessed in the ISerializationCallback callbacks and might not work correctly when used. These callbacks main purpose is to allow users to add serialization support of types that the Unity serialization does not support. Unfortunately, we cannot block usage of the Unity APIs in these callbacks, as some use cases work and it would therefore be a breaking change.

    A bit more background info on this: https://blogs.unity3d.com/2016/06/06/serialization-monobehaviour-constructors-and-unity-5-4/

    We won't fix this issue and if you have a use case that is not currently supported with our existing API, please file a feature request through the Unity Feedback website: https://feedback.unity3d.com/

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.