Search Unity

Simple In-App Purchase System (SIS) - Shop solution

Discussion in 'Assets and Asset Store' started by Baroni, Aug 8, 2013.

?

Which billing plugin are you using in combination with Simple IAP System?

  1. Unity IAP

    173 vote(s)
    86.5%
  2. Voxel Busters

    10 vote(s)
    5.0%
  3. Stans Assets

    13 vote(s)
    6.5%
  4. Prime31

    4 vote(s)
    2.0%
  1. 8bitCartridge

    8bitCartridge

    Joined:
    Feb 26, 2014
    Posts:
    144
    @Baroni
    lol... I knew that ;)
    thnx.
     
  2. 8bitCartridge

    8bitCartridge

    Joined:
    Feb 26, 2014
    Posts:
    144
    @Baroni

    Sorry to bother you again Baroni, but now I got a different problem as soon as I added IAP Manager in the first scene, currency amount is displayed correctly, but I've just noticed that if I play (go through first scene, level scene, game over scene) and go back to first scene again and open my shop: ALL OF THE IAPItems and IGCItems SS and IGCItems U all of them are DOUBLED / duplicated ... what's going on here? Let me just tell you something.. in my second scene I also have a shop set up (in-game shop) and if in editor/Unity I start from second scene all of the currency amounts display correctly and I don't have IAPManager prefab there, while I had the same exact setup in the first scene currency wasnt displaying, until I added IAP Manager, but as I already mentioned it messed everything up and gives me DOUBLES / DUPLICATES of all of my Items in the shop.

    Why even add a IAP Manager prefab, when it is inited by itself ? Meaning - if I don't add it to the scene, it appears when I press PLAY. (Did I do something wrong, is it not supposed to appear?) I mean that's the way you have it set up in your example scenes, there is no IAP Manager Prefab in the scene, it's inited after you press Play. ( I used ListHorizontalTabs example scene for my project)




    Please help... Thank you in advance!!!


    EDIT: FIXED IT... set up a new shop with new ShopManager prefab in the first scene and without IAP Manager prefab... just like you have it in your demo scenes. Everything works.
     
    Last edited: Nov 12, 2014
  3. 8bitCartridge

    8bitCartridge

    Joined:
    Feb 26, 2014
    Posts:
    144
    @Baroni

    Screen Shot 2014-11-11 at 9.06.28 PM.png
    I'm sorry.... but SIS is giving me a headache and I don't know why... all of the purchases were working fine a minute ago, now I get this error. did't change or add any new items / ids.
     
  4. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    The IAPManager prefab should always be placed in the first scene, there is no exception to that. Your "fix" isn't a fix, really. ShopManager will instantiate an IAPManager copy if it can't find one, but this is just for debugging purposes and you will also get a warning if you've enabled debugging on the ShopManager prefab. The demo scenes have an IAPManager prefab in the first scene, which is the "AllSelection" scene. I'll investigate what causes the duplicated items with ShopManager prefabs in multiple scenes.

    Regarding your error: have you modified the IAPManager script for IOS Native? In my IAPManager.cs, line 618 is a comment.
     
  5. 8bitCartridge

    8bitCartridge

    Joined:
    Feb 26, 2014
    Posts:
    144
    no i didn't touch that script. It does give me duplicates every time ONLY IF i put in IAPManager in myself, but if I dont everything works fine. Can I just not put it in myself and rely on ShopManager to instantiate it?(because that seems to work fine - no duplicates). IF NOT, then how do I get rid of the duplicates.

    That error line 618... I have no clue what it is, for now I just use a previous copy of my project where everything was fine... thank god I back up frequently :)

    Please let me know if you find out anything about those duplicates, what is causing it? and of course how to fix it.

    Thank you sir!

    Edit: IAPManager.cs error line 618 its not talking about InAppPurchaseManager.cs from IOS Native.

    Screen Shot 2014-11-11 at 11.59.13 PM.png
     
    Last edited: Nov 12, 2014
  6. ray2fr

    ray2fr

    Joined:
    May 5, 2013
    Posts:
    6
    Uh... Unity 4.6 required?
    The latest released version of Unity is 4.5.5, so what does this 4.6 mean???
    Do we have to use the beta? Is that really safe?
     
    Last edited: Nov 12, 2014
  7. 8bitCartridge

    8bitCartridge

    Joined:
    Feb 26, 2014
    Posts:
    144
    @Baroni

    Hey Baroni, I was wondering if you had a chance to look into / investigate what is causing duplicated items with ShopManager prefab in 2 scenes.
    Thank you.

    @ray2fr
    Hey dude, I'm using 4.6 (20) ~ something STABLE BETA, it works perfectly.
     
  8. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    It was related to the Unity method execution order. Put the following code at the beginning of IAPManager's OnLevelWasLoaded method and please let me know if this fixes it.
    Code (csharp):
    1. if (instance != this)
    2.    return;

    What @8bitCartridge said, or have a look at this thread.
     
  9. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    738
    uGui integration..
    Instabuy!
     
  10. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Thanks ;) An update for Unity 4.6 RC1 will go live later today, which fixes some harmless warnings.
     
  11. 8bitCartridge

    8bitCartridge

    Joined:
    Feb 26, 2014
    Posts:
    144
    @Baroni

    :D :D :D That fixed it!!! Thank you so much Baroni!!!
     
  12. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    @8bitCartridge
    Great, thanks! It's already included in the next update.
     
    8bitCartridge likes this.
  13. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Version 2.4.1 (uGUI/NGUI)

    • removed Input.multiTouchEnabled code in ShopManager, this should be handled by the developer on a per-project basis instead
    • added warning if initializing billing plugin without store key on Android
    • added warning if ShopManager does not find an IAPManager instance
    • UpdateFunds script now detects currency changes through DBManager too
    • fixed duplicated shop items when using multiple ShopManager in scenes
    • added quick way to check if an item is selected via DBManager.isSelected
    • Prime31: updated IAPManager to newest Android API, solving a compiler error
     
    8bitCartridge likes this.
  14. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    @Dean Kuai
    Hi Dean,
    I didn't receive an email from you, sorry for the delay. Could you send me your invoice no. in a private message here?
     
  15. Dean-Kuai

    Dean-Kuai

    Joined:
    Jun 17, 2013
    Posts:
    24
    Hi Baroni, i failed to send you a message, unity kept saying it's spam-like or inappropriate :( So I sent another email to info@rebound-games.com, please check it.
     
  16. SIV

    SIV

    Joined:
    May 7, 2014
    Posts:
    219
    Hey,
    I just bought it, and i was wonder if i have 2 kind of coins (like coin and diamond) is your plugin allow to use diamonds to buy coins ? if yes how please ?
     
  17. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Hey SIV,
    thanks for your purchase. First you have to set up two currencies in the "In Game Content" tab in the IAP Settings editor. In the IAPListener script, you tell your app what happens when buying items. So there you can define something like
    Code (csharp):
    1. case "diamonds":
    2.     DBManager.IncreaseFunds("coins", 100);
    3.     ShopManager.ShowMessage("Bought coins for diamonds!");
    4.     break;
    Please have a look at our video tutorials on our YouTube channel for an overview.
     
  18. SIV

    SIV

    Joined:
    May 7, 2014
    Posts:
    219
    Ok thanks, also it require unity3D 4.6 ? mean 4.5 cant use it ?
     
  19. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
  20. alexsan75

    alexsan75

    Joined:
    Feb 6, 2012
    Posts:
    95
    Hi there,
    bought SIS asset few months back - great asset must say! :) (version v2.2.1a)

    Have a question about update:
    I'm using Unity 4.5.5 with NGUI 3.6 and Unibill 1.6.8 I see that the latest update requires Unity 4.6 (I red a thread about it too).

    I like to continue using NGUI, and also want to wait until the official release of Unity 4.6 (not beta as now).
    q: is there an update of SIS after v2.2.1 for Unity 4.5.5 with NGUI? do you still plan to continue support for SIS with NGUI in future updates?
    The reason I'm asking - I've made an update of Unibill and got some persistent Error in SIS asset :( wondering if next release of SIS asset is fully compatible with the latest version of Unibill and can fix that error?
    Thanks!
     
  21. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Hi alexsan75,
    thanks! Please send an email with your invoice no. to info [at] rebound-games [dot] com, to receive a download link for the latest NGUI-compatible version (2.4.1). Unibill fixes were in 2.3.3. I am trying to support the NGUI version until there's no longer a need for it.
     
  22. alexsan75

    alexsan75

    Joined:
    Feb 6, 2012
    Posts:
    95
    Awesome, thanks!
    just sent an e-mail as stated, appreciate.
     
  23. Tressor_Studio

    Tressor_Studio

    Joined:
    May 28, 2013
    Posts:
    45
    Hi, you plugin have the necessary for make in app purchase into a game or i have to buy others plugins too ?
     
  24. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Hi Efect,
    if you use uGUI for the user interface (free in Unity 4.6) and OpenIAB for billing (free), then you don't need to buy any other plugins.
     
  25. Tressor_Studio

    Tressor_Studio

    Joined:
    May 28, 2013
    Posts:
    45
    If i download OpenIAB for billing (free) i have to configure or scripting something ? or your plugin make all the work ?
     
  26. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    @Efect
    You only have to do scripting in Simple IAP System. It takes care of the whole billing part. Watch this video on our channel for a quick overview.
     
  27. alexsan75

    alexsan75

    Joined:
    Feb 6, 2012
    Posts:
    95
    Hej,
    I'm working with my own version/theme of the IAP shop based on SIS asset, mostly going well!

    If I want to add a new Window and follow provided Manual where it says (for windows template):
    -------------------------
    "Adding a new window works just as described earlier: create the window and link an IAP group to its container in IAP Settings. Attach an Tween Position component to it.",
    -------------------------
    I cannot find where exactly I should link an IAP group to its container? sorry for this naive question, but I checked everythere..

    The structure in the SIS assest is: UI Root -> Camera -> Window-Custom -> ... -> Container that is specific for IAP prefabs, but how do I link to it? Under IAP settings I can only set list of products and group names, but find no linking options, unfortunat. ..

    Appreciate your help on this! a screenshot may be or abit more detailed description will sure help :)
     
  28. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Hi alexsan75,

    "linking an IAP group to its container" means that you specify the parent object for your prefabs in the IAP Settings editor. You can see the "Parent" object in this screenshot, right next to the "Prefab" slot.
     
  29. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    I'm trying to figure out the *proper* way to use SIS. Can you verify?

    So when my game starts, I should put the IAPManager prefab in the very first scene, so it will persist through all the scenes. Then later, when the player goes through some menus and clicks on the Shop scene, I will have the ShopManager prefab in that scene. Then I should call the ShopManager.Init() manually every time the player enters that scene. The ShopManager will not persist once the player leaves the Shop scene.

    Is that correct? Thanks Baroni
     
  30. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    @eridani
    It's the same in the example scenes: IAPManager in the first (AllSelection) scene, ShopManager in the others. The IAPManager will init ShopManagers automatically, I can't remember why you want to init them manually.
     
  31. alexsan75

    alexsan75

    Joined:
    Feb 6, 2012
    Posts:
    95
    Oh, I see! that's why I didn't find this :) because in my case it says there: "No ShopManager prefab found in this scene!", -> I see no extra fields, but I have ShopManager prefab in this scene.
    I did something wrong.. how to correct this?
     
  32. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    @alexsan75 Did you try re-opening the IAPSettings window?
     
    alexsan75 likes this.
  33. alexsan75

    alexsan75

    Joined:
    Feb 6, 2012
    Posts:
    95
    Yes! that did the trick lol .. it's complete now.
    The thing is that as soon as I open another Scene (and those are few, of course), I have to close and re-open IAP Settings window, otherwise Prefab's settings just disappear, but that's Ok - now I know what's the problem.
    Is it just some SIS little bug or something else? I use Unity 4.5.5.

    Thank you so much!
     
  34. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Scene properties such as the "Prefab" and "Parent" slot can't be saved between scenes (because they only exist in this specific scene), but I should probably reload the window after switching scenes. Good catch!
     
    alexsan75 likes this.
  35. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    I'm just presuming by looking through the code. Because the IAPManager tries to init the ShopManager in its Awake(). Since there won't be a ShopManager in the first scene, no ShopManager will be initialized by IAPManager.

    If I have a later scene that has a ShopManager in it, I think it won't be initialized because the persistent IAPManager won't run Awake() again even when a new scene is loaded. And here's the code for the ShopManager... it has no Awake(), and Start() doesn't do anything in terms of initialization. So it would require a manual call to Init() no?

    EDIT: Thanks Baroni
     
    Last edited: Nov 20, 2014
  36. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    IAPManager.cs has a method called OnLevelWasLoaded, which gets called on every scene. No, you don't have to manually initialize ShopManagers. Please remove the code from your post.
     
    eridani likes this.
  37. SIV

    SIV

    Joined:
    May 7, 2014
    Posts:
    219
    Hey,
    How to connect the currencies in In Game Content with the currency of my actual game ?
    So that when i use/add funds both (SIS plugin currency and my game currency) update
     
  38. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Hi SIV,
    you would not connect your currency to SIS - use only one currency instead. The DBManager has several methods for increasing or getting the currency amount in SIS, so there is no need to duplicate that one. Have a look at the sample scenes and the label used for displaying the current amount of currency.
     
  39. SIV

    SIV

    Joined:
    May 7, 2014
    Posts:
    219
    Ah ok i get it,
    One quick question, when i add a new currency in In Game Content i want to be able to select a default currency for each Group i create.
    For example i have coins and diamonds,
    I want coins to be for group1 and diamonds for group2 how to do that please ?
    And also make that group use the selected currency ONLY.
     
  40. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    @SIV
    I've pretty much answered this question over here, please let me know if anything is still unclear.
     
  41. SIV

    SIV

    Joined:
    May 7, 2014
    Posts:
    219
    Yes i know that one but what if i want EACH group to have different currency ?
    For example if i want to buy coins using diamonds in group1, and then buy health using coins in group2, you get the point ?
     
  42. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Currency is available on a system-wide basis. If you want that one group only has one currency (e.g. coins), set coins and leave diamonds at zero. Then specify an IAPItem prefab for this group that only displays coins.
     
  43. SIV

    SIV

    Joined:
    May 7, 2014
    Posts:
    219
    Yes, thanks man :)
     
  44. SIV

    SIV

    Joined:
    May 7, 2014
    Posts:
    219
    Hi,
    I delelted the "no_ads" from IAP settings but it still visible during the game, maybe i missed something ?
    Also when i run the game on an android device, i see that the shop elements are showed double time in same slider !
     

    Attached Files:

    • rest.png
      rest.png
      File size:
      222.2 KB
      Views:
      878
  45. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    @SIV
    Hi, try saving the scene and closing the IAP Settings window for your changes to take effect. Also make sure that you only have one IAPManager in your game, only in the first scene (not another one in the shop scene), and that you actually start from there on the device. You will see a warning in the console if you don't.
     
  46. SIV

    SIV

    Joined:
    May 7, 2014
    Posts:
    219
    Now i dont have the shop double time but still the "no_ads" item is displaying.
    I have 3 scenes on the build setting :
    0 : Main (contain the IAPManager)
    1 : Shop
    3 : Game

    When i open the Main scene then go to Shop scene the "no_ads" item is still there but when i open directly the Shop scene and run the game the "no_ads" item is not there !! this is confusing lol
     
  47. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Did you close the IAP Settings window and are you using the latest version? (release notes)
    Also is the IAPManager in your first scene still connected to the prefab?
     
  48. SIV

    SIV

    Joined:
    May 7, 2014
    Posts:
    219
    Yes i have latest version and yes i closed that window.

    I didint get this, how to verify that ? what prefab you are talking about please ?
    What i done is place the IAPManager to a folder then drag it back in the Main scene and remove it from the Shop scene.
     
  49. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Your changes in the IAP Settings window will be saved to the IAPManager prefab under SIS > Prefabs > Resources. Do not create your own IAPManager prefab - use the existing one there. Instances in the hierarchy are highlighted in blue if they are connected to their prefabs.
     
    SIV likes this.
  50. SIV

    SIV

    Joined:
    May 7, 2014
    Posts:
    219
    Oh, hehe now it make sence, and yes now everything 100% working :)