Skip to content

[CRITICAL] SerializedDictionary does not serialize changes made from script in Unity 6000.0.73f1 #19

@briezar

Description

@briezar

Environment

  • Unity version: 6000.0.73f1

Description

SerializedDictionary does not serialize or refresh correctly when modified from script.

If the dictionary is modified via scripting such as in OnEnable, the runtime value changes but the Inspector does not update. Changes will be lost upon script recompilation.

Reproduction

Example:

using UnityEngine;
using AYellowpaper.SerializedCollections;

public class TestBehaviour : MonoBehaviour
{
    [SerializeField]
    private SerializedDictionary<int, int> _dictionary;

    private void OnEnable()
    {
        _dictionary.Clear();
        _dictionary.Add(Random.Range(0, 100), Random.Range(0, 100));

        Debug.Log(_dictionary.Count);
    }
}

Steps to reproduce

  1. Add the component to a GameObject.
  2. Observe the dictionary in the Inspector.
  3. Enter Play Mode.

Expected result

The Inspector should reflect the modified dictionary contents.

Actual result

  • Debug.Log shows the dictionary was modified successfully.
  • The Inspector does not update to reflect the changes.
  • The serialized value is unchanged.

Notes

This issue has a 100% reproduction rate on Unity 6000.0.73f1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions