Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
1
Question by RFLG · Aug 13, 2012 at 04:38 PM · c#iospluginprime31storekit

How to bind Prime31 ios storekit plugin with GUIText elements?

Hello everyone!

So, I've bought the storekit plugin from prime31, did a successfull implementation with all the items on the demo working and managed to get it working on my project also (sort of).

As I move into more complex scenarios, I'm incurring into a rather singular problem, for which I need your help.

I'm doing these operations on my code:

1-I want to fill a couple of GUIText objects with the product details. So I have a :Monobehaviour c# class where I handle all my GUI matters and where I call the StoreKit plugin.

2-So, I start by getting a List products from StoreKitManager.productListReceived, I then to all the required value assigning (from variables to the GUI controls).

3-Finally I make my "form" visible and was supposed to get the product data visible on the screen.

What really happens is that the form is returned blank...This is what I've debuged so far:

1-Added some Debug.Logs around to check if stuff was getting done. Confirmed that it is, so the connectability is working just fine, with product data being returned from the appstore.

2-Also detected that some debug.log are being printed only when execution ends, meaning that they are being printed way after their supposed execution point.

So my questions to you guys are:

1-Is debug.Log supposed to print immediatly upon call, or it may print with delay?

2-I'm left with the impression that for some reason there is a delay on the response from the appstore and unity just runs the rest of the code without waiting. Is this assumption correct? How can I fix it?

Below I'm sending a sample of the source code I'm using:

 var productIdentifiers=new string[]{"myIdentifier"};
  StoreKitBinding.requestProductData( productIdentifiers );
  
  //Debug.Log( "In!! ");
  List<StoreKitProduct> _products=new List<StoreKitProduct>();
  
  StoreKitManager.productListReceived += allProducts =>
  {
                     //this one only gets printed after everything else is done...is it supposed to??
  Debug.Log( "received total products: " + allProducts.Count );
  _products = allProducts;
  };
  
  
  if(_products.Count>0)
  {
                     //this section is never hit
  Debug.Log("haz product");
  foreach(StoreKitProduct product in iapWrapper._products)
  {
  IAPFormDesc.GetComponent<GUIText>().text="Product Description: "+ product.description;
  IAPFormName.GetComponent<GUIText>().text="Product Name: "+ product.title;
  IAPFormPrice.GetComponent<GUIText>().text="Price: " +product.price;
  }
  }
  else
  {
  IAPFormDesc.GetComponent<GUIText>().text="Product Description:" ;
  IAPFormName.GetComponent<GUIText>().text="Product Name: ";
  IAPFormPrice.GetComponent<GUIText>().text="Price: " ;

                     Debug.Log("no product?!");
  }
  
  //I tried to make unity "wait" a while, but at no avail...
  float time=30.5F;
  
  StartCoroutine(Wait(time));

             //here I show my form
  showIAPForm();
  
      Debug.Log("LoadingForm"); 

Thanks for the help guys!

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
1
Best Answer

Answer by RFLG · Aug 13, 2012 at 09:58 PM

Well, It's kinda a silly answering myself, but I talked with the good people at prime31 and the problem was solved!

In order to share the knowledge, here goes the solution provided:

1-For my first question the answer was yes, Debug.Log is supposed to print right after it is called.

2-For my second question the answer was also yes, indeed the appstore sometimes takes it's time replying to requests.

My problem was that I was separating the request/response process and the GUI/Form filling, making them different processes.

Following prime31's advice, after using the events provided on the plugin and making the GUI changes fully dependant on the product request event, it's working like a charm!

Comment
Add comment · Show 3 · 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 robotmechanic · Sep 27, 2012 at 05:00 AM 0
Share

I am having the same issues too. Users can navigate out of the store area before the purchase is complete and therefore leave the area where the storekit scripts were being ran.

For clarification, I am guessing you basically don't allow the user to do anything until a purchaseSuccessful or purchaseFailed event occurs, right?

avatar image Nabeel Saleem · Mar 31, 2014 at 07:56 PM 0
Share

i get this plugin am i have to make change only storkitguimanager.cs? or other files too? unity3diy

avatar image RFLG · Apr 01, 2014 at 02:54 PM 0
Share

Well Nabeel, it really depends on what you want to do. I wrote a small article about In-App purchases with and without Prime31's plug-in on our tech blog. It covers most of what you can and can't do, and also some pointers on how to do some operations. You can read it here: http://wecamefrommars.tumblr.com/post/63176938499/implementing-in-app-purchases-with-unity3d

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

9 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Bug with EtceteraGUIManager.cs . 1 Answer

Game crashed on IOS 0 Answers

Distribute terrain in zones 3 Answers

iOS Plugin - Pass a struct from C++ to C# 1 Answer

Dll distribution of Conditionally Compiled project 0 Answers


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