Unity-SerializableDictionary
Unity-SerializableDictionary copied to clipboard
SerializableDictionary<GameObject, Type[]> won't serialize.
Hi,
I noticed that any Dict with GameObject
as a key cannot serialize arrays as its values. I discovered this first with my own data type, but found that the same held true for <GameObject, string[]>
for instance. Using GOs as keys to non-array values works as expected. This behaviour was observed on a Scriptable Object
.
When setting these from script: The values are assigned correctly, but get cleared as soon as Play Mode is entered or anything gets recompiled.
When assigning from the Inspector: As soon as I try to set the GO key field the entire entry disappears.
you should be using the gameObjects unique identifier rather than the object itself the issue however is that game objects do not typically instantiate with the same properties, you should probably use some sort of global class or GUID system