Search Unity

[Solved] How to show loading gif like AJAX request from start of the InitiatePurchase to Complete?

Discussion in 'Unity IAP' started by orkungo, Nov 28, 2017.

Thread Status:
Not open for further replies.
  1. orkungo

    orkungo

    Joined:
    May 3, 2014
    Posts:
    62
    Hi,

    I am implementing Unity iAP to my game. I have non-consumable goods for sale, at the current version of Purchase script, Buy process starts with InitiatePurchase function and ends whever ProcessPurchase.Complete action is returned. Within this process, I would like to block all bacground elements and show a gif just like we do at Ajax requests. However, I can not find a proper way since the API is a bit closed.

    Is there any ideas how to achieve this?
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  3. orkungo

    orkungo

    Joined:
    May 3, 2014
    Posts:
    62
    Sometimes it waits long time for a response from Apple.. Therefore I dont think that coroutines would be sufficient.

    I am looking for a way to get a callback to set gif active when the process starts and whenever the player is done with the Appstore ID password insert to purchase and as the transaction process is complete, I want to deactivate the gif.
     
    Last edited: Nov 29, 2017
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @orkungo Your best option at this point would be as I described, setting the co-routine after InitiatePurchase returns. I will mention this again to the IAP team and see we could offer additional options in a future release.
     
  5. orkungo

    orkungo

    Joined:
    May 3, 2014
    Posts:
    62
    Alright. That would be great if an option could be offered, it would be a big plus for UX.
     
  6. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    I checked with the IAP team again. InitiatePurchase just puts a message into the Apple message queue and typically is very fast. Testflight might be slower. There isn't anything we can do internally to provide additional control. It was advised however for you to consider calling your co-routine call just prior to calling InitiatePurchase which should accomplish what you need.
     
  7. orkungo

    orkungo

    Joined:
    May 3, 2014
    Posts:
    62
    Thanks a lot. I use a custom canvas with a gif now, setting it active as the InitiatePurchase start, deactivate it as the process complete. I need this gif because, as the purchase is complete I send some data to database and do some calculations locally, then unlocking purchased items. Delay might be because of TestFlight, that is also what I am suspicious.
     
Thread Status:
Not open for further replies.