NullReferenceException - Dictionary
Posted: Fri Apr 10, 2015 4:00 pm
I have been using EasySave2 for a long time and it works great for me. It's very useful, especially the simplicity of the web saving.
Just yesterday, was adding a Dictionary to my data structure and I am getting the following Null Reference Exception:
This is just a simple Dictionary. I created a test project to isolate the issue, with this in Start():
I read the topic here: http://www.moodkie.com/forum/viewtopic. ... ce+not+set, which seemed similar, though I'm not using a custom data type. And I followed the suggestion you made, in case it was related to my issue:
I don't get this error with other types: List, string, int, etc.
I am currently using Unity v4.6.1f1
And it looks like I'm using ES2 v2.6.2 (I avoid updating in the middle of a project if I can)
Just yesterday, was adding a Dictionary to my data structure and I am getting the following Null Reference Exception:
Code: Select all
NullReferenceException: Object reference not set to an instance of an object
ES2Writer.WriteHeader (System.String tag, Key collectionType, .ES2Type valueType, .ES2Type keyType)
ES2Writer.Write[String,Object] (System.Collections.Generic.Dictionary`2 param, System.String tag)
ES2.Save[String,Object] (System.Collections.Generic.Dictionary`2 param, System.String identifier)
testScript.Start () (at Assets/testScript.cs:17)
Code: Select all
Dictionary<string, object> dataDict = new Dictionary<string, object>();
dataDict.Add("keyname1", "valueString");
dataDict.Add("keyname2", 100);
ES2.Save(dataDict, "data/datafile.txt" + "?tag=dictionary_01");
But, this did not help me.Try going to Assets > Easy Save 2 > Manage Types ... and pressing the Refresh ES2Init button at the top. Sometimes when updating the Asset Store accidentally suppresses the script which automatically updates the ES2Init file. The errors you're getting would definitely point at this.
I don't get this error with other types: List, string, int, etc.
I am currently using Unity v4.6.1f1
And it looks like I'm using ES2 v2.6.2 (I avoid updating in the middle of a project if I can)