Skip to content

Instantly share code, notes, and snippets.

@satoshikumano
Last active August 29, 2015 13:57
Show Gist options
  • Save satoshikumano/9825433 to your computer and use it in GitHub Desktop.
Save satoshikumano/9825433 to your computer and use it in GitHub Desktop.
Loading Object from Uri (Unity)
// Omitting error handling to simplify the code.

// First time object creation on Kii Cloud.
KiiObject userProf = Kii.Bucket("myBucket").NewKiiObject();
userProf["userProf1"] = "prof value1";
userProf["userProf2"] = "prof value2";
userProf.Save();

// Store Object Uri in local storage.
Uri uri = userProf.Uri;
PlayerPrefs.SetString("userProfUri", uri.ToString());

// Load Object from Uri and edit.
string userProfUri = PlayerPrefs.GetString("userProfUri");
KiiObject loadedProf = KiiObject.CreateByUri(new Uri(userProfUri));
loadedProf["userProf3"] = "prof value3";
loadedProf.Save();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment