thieumao

Unity - Parse.com - Update data

Sep 1st, 2015
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.78 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using Parse;
  5. using System;
  6. using System.Threading.Tasks;
  7.  
  8. public class Mao : MonoBehaviour
  9. {
  10.  
  11.     // Use this for initialization
  12.     void Start()
  13.     {
  14.  
  15.         var query = new ParseQuery<ParseObject>("GameScore")
  16.             .WhereEqualTo ("objectId", "GY5pnlDaOJ");
  17.        
  18.         query.FindAsync().ContinueWith(t =>
  19.                                        {
  20.             var tokens = t.Result;
  21.             IEnumerator<ParseObject> enumerator = tokens.GetEnumerator();
  22.             enumerator.MoveNext();
  23.             var token = enumerator.Current;
  24.             token["score"] = 2015;
  25.             return token.SaveAsync();
  26.         }).Unwrap().ContinueWith(t =>
  27.                                  {
  28.             // Everything is done!
  29.             //Debug.Log("Token has been updated!");
  30.         });
  31.  
  32.  
  33.     }
  34.  
  35.  
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment