Hi, I can't get Steam overlay to show up. Once I execute the code bellow, both StartPurchase() and PayForPurchase() return the expected results but the Steam overlay still does not show up. In my Unity project I have a GameObject with the SteamManager script attached which triggers SteamAPI.Init(). I have another script which triggers PlayFabClientAPI.LoginWithSteam() and that one also returns the expected result. This is my code:
using PlayFab; using PlayFab.ClientModels; using Steamworks; using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class PurchaseTest : MonoBehaviour { protected Callback<MicroTxnAuthorizationResponse_t> m_MicroTxnAuthorizationResponse; string orderID = ""; public Text text; // Use this for initialization void Start() { if (SteamManager.Initialized) { m_MicroTxnAuthorizationResponse = Callback<MicroTxnAuthorizationResponse_t>.Create(OnMicroTxnAuthorizationResponse); } } public void StartPurchaseProcess() { PlayFabClientAPI.StartPurchase(new StartPurchaseRequest() { CatalogVersion = "myCatalog", Items = new List<ItemPurchaseRequest>() { new ItemPurchaseRequest() { ItemId = "sword", Quantity = 1, Annotation = "Purchased via in-game store" } } }, result => { text.text += Environment.NewLine + "StartPurchase: " + result.OrderId; Debug.Log("StartPurchase: " + result); orderID = result.OrderId; PurchaseOnSteam(orderID); }, error => { text.text += Environment.NewLine + "StartPurchase FAILED"; Debug.Log("StartPurchase FAILED: " + error.ErrorMessage); }); } private void PurchaseOnSteam(string orderId) { PlayFabClientAPI.PayForPurchase(new PayForPurchaseRequest() { OrderId = orderId, ProviderName = "Steam", Currency = "RM" }, result => { text.text += Environment.NewLine + "Purchase on steam"; Debug.Log("PurchaseOnSteam Success: " + result); }, error => { text.text += Environment.NewLine + "SENT TO STEAM FAILED"; Debug.Log("PurchaseOnSteam Failed: " + error.ErrorMessage); }); } private void OnMicroTxnAuthorizationResponse(MicroTxnAuthorizationResponse_t pCallback) { if (pCallback.m_bAuthorized == 1) { text.text += Environment.NewLine + "Authorized Payment: " + pCallback.m_ulOrderID.ToString(); Debug.Log("OnSteamApproval authorized!"); ConfirmPurchase(orderID); } else { text.text += Environment.NewLine + "Failed to authorize payment"; // Player didn't authorize the payment Debug.Log("Failed to authorize payment"); } } private void ConfirmPurchase(string orderId) { PlayFabClientAPI.ConfirmPurchase(new ConfirmPurchaseRequest() { OrderId = orderId }, result => { text.text += Environment.NewLine + "CONFIRMED PURCHASE"; Debug.Log("Final ConfirmPurchase: " + result); }, error => { text.text += Environment.NewLine + "FAILED: " + error.Error; text.text += Environment.NewLine + error.ErrorMessage; Debug.Log("Failed ConfirmPurchase: " + error.ErrorMessage); }); } }
What am I doing wrong? Hope someone can help me out with this.
Thanks!