- Home /
Dictionary and Array get nulled out after script change
My dictionary and array become null when I modify my script and go back to Unity when playing. What could be causing this ?
Assu$$anonymous$$g you're not modifying a script during play mode, which you really shouldn't do, then it might be one of these things?
unity can't serialize dictionaries, you'll have to create your dictionary at runtime or serialize a binary or json object. Resources.Load and load such objects. Also scriptable objects shouldn't be set to serialize themselves, nor should their contents unless you are creating a subclass, it automatically serializes them with Unity. Same goes with monobehaviours, no serialization needs to be defined except on subclasses that contain data, or object you personally intend to serialize.
You're probably right, I think It's a serialization problem. Basically, I have a serialized database class that stores info about the player, it's inventory and a Dictionary<string, bool>
that triggers true to every element in it so it can notify any linked script for changes so I don't have to update every frame. I'll probably use PlayerPrefs, Thank you !
Your answer
Follow this Question
Related Questions
Runtime Error 0 Answers
Object Detection App fails on load " Internal Scriptable Runtime method not found" 0 Answers
how can I check if an object is null? 4 Answers
what is null 1 Answer