Search Issue Tracker

Won't Fix

Votes

0

Found in

2021.3.27f1

2022.3.1f1

2023.1.0b20

2023.2.0a18

Issue ID

UUM-37568

Regression

No

ScriptableObject doesn’t receive the “OnDisable” callback when it’s loaded from AssetBundle during playmode exit

-

How to reproduce:
1. Open the user’s attached “AssetBundleTestProject.zip” project
2. Enter Play Mode
3. Exit Play Mode and observe the Console window

Expected result: “MyScriptableObjectAsset - OnDisable” is called
Actual result: “MyScriptableObjectAsset - OnDisable” is not called

Reproducible with: 2021.3.27f1, 2022.3.1f1, 2023.1.0b20, 2023.2.0a18

Reproduced on: macOS 13.2.1 (Intel)

Note: not reproducible with “OnEnable”

  1. Resolution Note:

    Risks with fixing that for existing LTS is not acceptable (would break user code). Risk with fixing that for 2023 LTS is that we are quite late in the process, and there is a very high Halo effect coming with this: that would probably require a team focus that we can’t afford.
    Captured as a task in backlog for future version of Editor (no backports), we can’t guarantee that we’ll be done by then, but we’ll try.
    What can be done for now at least is documentation fix https://docs.unity3d.com/ScriptReference/ScriptableObject.OnDestroy.html
    by replacing statement from:
    “This function is called when the scriptable object will be destroyed.”
    to “The callback is only called if Object.Destroy() or Object.DestroyImmediate() is called directly.”

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.