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)