Hello, I am trying to make this class reusable and depending on the "FriendlyId" of the item in the store Playfab will find it and that item will be bought and added to the players inventory. I am unsure why it isnt working though. The console does not give me any errors but it also doesnt do anything from my knowledge. I am using unity and C# to do this. Any advice or help would be greatly appreciated. I feel as though I very close to getting it working.
using System.Collections; using System.Collections.Generic; using UnityEngine; using PlayFab; using PlayFab.ClientModels; using PlayFab.EconomyModels; public class ItemToBuy : MonoBehaviour { public int glimmersPrice; public string itemName; public void BuyItem2() { var request = new AddInventoryItemsRequest { Amount = 1, Item = new InventoryItemReference { AlternateId = new PlayFab.EconomyModels.AlternateId {Type = "FriendlyId", Value = "{ItemName}"} } }; PlayFabEconomyAPI.AddInventoryItems(request, OnBuyItemSuccess, OnError); } void OnBuyItemSuccess(AddInventoryItemsResponse response){ Debug.Log("Bought item! " + itemName); } void OnError(PlayFabError error) { Debug.Log("Error: " + error.ErrorMessage); } }