Last active
December 17, 2015 14:59
-
-
Save prime31/5628356 to your computer and use it in GitHub Desktop.
Example of Parse access from Unity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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