Search Issue Tracker

By Design

Votes

1

Found in

5.4.0b13

Issue ID

788816

Regression

No

Custom Editor does not serialize UnityEvent parameters when using SerializedObject

IMGUI

-

Steps to reproduce:

1. Open attached project
2. Open scene "Scene"
3. Select the "Events" object in the hierarchy
4. Add a new event or just click the "+" to add an action to an existing one
5. Add some object (for example the Main Camera)
6. Select a function (for example GameObject.SetActive)
7. Change the default parameter to something else (in the above case, check the checkbox)
8. Select another object from the hierarchy (for example Main Camera)
9. Then select the "Events" object again
10. The checkbox has been reverted to it's default state

Reproduced with: 5.2.4f1, 5.3.4f1, 5.4.0b15

  1. Resolution Note:

    The problem is that the user is creating a new SerializedObject representation for each of the ScriptableObjects in every phase of the IMGUI loop in the MyComponent editor. For example, if the user adds [CreateAssetMenu] attribute to the MyScriptableObject class and simply creates one in the project, the problem does not appear to exist for that individual asset. Instead, the user should cache the SerializedObject values for each of the ScriptableObjects, and the problem seems to go away.

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.