Skip to content

Instantly share code, notes, and snippets.

@JoshuaStrunk
Created March 1, 2018 18:30
Show Gist options
  • Save JoshuaStrunk/357f8c8602b2c2de7529ed76ab3dac71 to your computer and use it in GitHub Desktop.
Save JoshuaStrunk/357f8c8602b2c2de7529ed76ab3dac71 to your computer and use it in GitHub Desktop.
public static void GetMoney(Action<string> onMoneyPulled, Action onFail)
{
PlayFabClientAPI.GetUserData(
new GetUserDataRequest(),
result => {
if (result.Data == null || !result.Data.ContainsKey("Money"))
{
Debug.Log("No value for money");
onFail();
}
else
{
amount = result.Data["Money"].Value;
Debug.Log(amount);
onMoneyPulled(amount);
}
},
(error) => {
Debug.Log(error.GenerateErrorReport());
onFail();
});
}
void Start() {
GetMoney(
money=> {
moneyText.text = money;
},
() => {
moneyText.text = "Failed to pull money";
}
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment