Skip to content

Instantly share code, notes, and snippets.

@prime31
Last active December 17, 2015 14:59
Show Gist options
  • Save prime31/5628356 to your computer and use it in GitHub Desktop.
Save prime31/5628356 to your computer and use it in GitHub Desktop.
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();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment