Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SerializableDictionary<GameObject, Type[]> won't serialize. #27

Open
SenshiSentou opened this issue Aug 30, 2021 · 1 comment
Open

SerializableDictionary<GameObject, Type[]> won't serialize. #27

SenshiSentou opened this issue Aug 30, 2021 · 1 comment

Comments

@SenshiSentou
Copy link

SenshiSentou commented Aug 30, 2021

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.

@digimbyte
Copy link

digimbyte commented Mar 7, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants