prime31
5/22/2013 - 3:13 PM

Example of Parse access from Unity

Example of Parse access from Unity

public class TestClass : ParseObject
{
	public string someOtherVar;
	public Dictionary<string, object> dict;
}


_parse = new Parse( "SNIPPED", "SNIPPED" );

// create object manually
var stuff = new Dictionary<string,object>();
stuff.Add("name", "turd");
stuff.Add("floatVal", 345.5f);
stuff.Add("dict", new Dictionary<string, object>
          {
	{ "number", 666 },
	{ "string", "dude looks like a lady" }
});
_parse.createObject( "TestClass", stuff );


// strongly typed object creation
var testClass = new TestClass();
testClass.dict = stuff;
testClass.someOtherVar = "a string";
testClass.save();


// fetch an object manually
var obj = _parse.getObject( "TestClass", "lDWGDdrxpd" );


// fetch an object strongly typed
obj = _parse.getObject<TestClass>( "lDWGDdrxpd" );

// modify and save it
obj.someOtherVar = "changed string";
obj.save();