The amount of the Virtual Currency I purchase doesn´t update.
This is the method I use to buy the virtual currency :
public void Give100Coins() { PurchaseItemRequest purchaseRequest = new PurchaseItemRequest(); purchaseRequest.CatalogVersion = "ShopItems"; purchaseRequest.ItemId = "Coins"; purchaseRequest.VirtualCurrency = "HC"; purchaseRequest.Price = 50; PlayFabClientAPI.PurchaseItem(purchaseRequest, result => { Debug.Log("You recieved 100 Coins"); }, error => { Debug.LogError(error.ErrorMessage); }); }
And this is the login method that I edited, in order to get the virtual currency.
public void Login() { loginWithEmail = new LoginWithEmailAddressRequest { Email = userEmail, Password = userPassword }; loginWithEmail.TitleId = PlayFabSettings.TitleId; //Virtual Currency loginWithEmail.InfoRequestParameters = playerInfo; // Request Login to PlayFab API PlayFabClientAPI.LoginWithEmailAddress(loginWithEmail, result => { HappyCoins = result.InfoResultPayload.UserVirtualCurrency["HC"]; OnLoginResult(result); }, OnPlayFabError); } public void OnLoginResult(LoginResult obj) { PlayerPrefs.SetString("EMAIL", userEmail); PlayerPrefs.SetString("PASSWORD", userPassword); PhotonNetwork.LoadLevel("Lobby"); }
I also activated the ability, for clients, to add and subtract virtual currency.
Do I need to have the latest PlayFab SDK, in order for this to work?
Thanks, in advance, for the help!