Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by bkachmar · Jul 12, 2016 at 08:25 AM · timeloadingdelayiapinitialization

Unity IAP InitializePurchasing taking too long.

Hello,

In my Unity application I am using Unity Purchasing module and I have basically a store.

By now we have 1000+ different in-apps and we continue adding more everyday.

At the beginning I am calling “InitializePurchasing” with a builder that has all the possible in-apps, but the problem is that it usually takes around a minute to finish the initialisation and I guess the more inapps we add - the longet it will take.

At the beginning in my store user can see up to 50 “Highlighted” items and usually users stay on this page for some time (enough to initialise all the other in app purchases).

What are the good practices to handle this problem?

I was thinking about a few ways:

  • Initiallize Highlighted items first and then start the initialisation of the whole store.

  • Initialise only those items that are on screen (usually 50), so that when switches page or changes browse filters - I re-initialise the store.

  • Initialise only those items that are on screen (usually 50), so that when switches page or changes browse filters - I re-initialise the store.

  • Initialise only one purcahse that user wants to buy on “Buy” button press.

  • Other way.

Thank you for your answers and comments.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by nicholasr · Jul 12, 2016 at 06:52 PM

Hi @bkachmar!

In Unity 5.4 we added a new API to handle fetching products incrementally:

http://docs.unity3d.com/540/Documentation/ScriptReference/Purchasing.IStoreController.FetchAdditionalProducts.html

Unity 5.4 release candidate is coming very soon - and the beta is already available. Will this work for you?

Nick

Comment
Add comment · Show 9 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image bkachmar · Jul 13, 2016 at 08:11 AM 1
Share

Hello @nicholasr,

Thanks a lot, I guess this will be the best option possible. Do you have any information on how long does that "very soon" take?

Best, Bohdan

avatar image nicholasr bkachmar · Jul 14, 2016 at 01:33 AM 0
Share

Re: Soon, sorry, not much more detail than "soon". It's based upon our QA progress. Hopefully weeks.

http://www.dumpaday.com/wp-content/uploads/2013/01/soon-polar-bear-and-seal.png

avatar image bkachmar · Jul 13, 2016 at 08:21 AM 0
Share

And one more thing,

How would you recommend adding 3 000 in app purchases: - One by one; - In groups of 100 - At the beginning initial 100 and then all the others?

avatar image nicholasr bkachmar · Jul 14, 2016 at 01:35 AM 0
Share

$$anonymous$$y opinion would be to see if groups of 100 creates the experience you want. Or perhaps 50.

Not size=1, and not size=1000, since I believe those will both be slower than you want.

But my "100 or 50" are guesses, and of course their performance may vary depending upon network conditions, etc.

Please if you do decide on "The Best Size" post it here, and I'll repeat it to others! :)

avatar image bkachmar nicholasr · Jul 14, 2016 at 07:22 AM 1
Share

Ok, I will post it "soon", when this will be released in stable version =)

Show more comments
avatar image davidb1 · Jul 26, 2016 at 11:37 AM 0
Share

@nicholasr Is there any way to get the new IAP version without downloading the whole beta version?

avatar image nicholasr davidb1 · Jul 26, 2016 at 06:40 PM 0
Share

@davidb1 One must download Unity 5.4 (https://unity3d.com/unity/beta as of writing this) and its newer UnityEngine.Purchasing.dll file to use the newer feature today. The feature has not been backported to Unity 5.3.x.

avatar image bkachmar · Aug 26, 2016 at 12:03 PM 0
Share

Hello,

So I downloaded second release candidate of Unity 5.4.0f2 and made everything this way: - I take first 50 purchases that appear on first screen, create a ConfigurationBuilder with those and initialize store. - On Initialized I remember IStoreController and IExtensionProvider and while I have more purchases available repeat next step - Wait one frame, create HashSet with next 50 inapps and FetchAdditionalProducts with that HashSet.

I tried to init in groups of 50 and in groups of 100 (I have around 1300 inapps) and it took {89.9, 85.8, 70.0, 74.3} seconds for 50-piece groups and {116.7, 72.23, 86.7, 83.3} seconds for 100-piece groups.

But purchasing doesn't work now. If I don't fetch new products the initial 50 can be purchased easily, but if I fetch more, neither first 50 nor others work =(

This is how my code looks like:

         ConfigurationBuilder builder = ConfigurationBuilder.Instance(StandardPurchasing$$anonymous$$odule.Instance());
         foreach (string highlightedId in highlightedIds)
         {
             builder.AddProduct(highlightedId, ProductType.NonConsumable);  
         }
         UnityPurchasing.Initialize(this, builder);

and after OnInitialized is called I wait one frame fill new HashSet with

 itemsHashSet.Add(new ProductDefinition(allIds[i], ProductType.NonConsumable));

and call the fetch function

 m_StoreController.FetchAdditionalProducts(itemsHashSet, OnProductsFetched, OnInitializeFailed);

All IDs display as expected in xCode and looks like everything is good, but when I test on device I get "ArgumentException: The requested value 'ItemUnavailable' was not found.".

I can see that my product is availableToPurchase and metadata is filled, but purchasing doesn't work. And again I I do not fetch additional products after I initialize store with first 50 inapps they work, but when I start fetching everything gives this exception.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Editor Playmode takes a while to load 0 Answers

How to WaitforSeconds a GuiButton ? 0 Answers

30 Objects all firing at exactly the same time and not randomly 1 Answer

Tips on optimizations for Android game startup speed? 0 Answers

Add Delay to Moving Platform 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges