ShowMessage() in IAPListener now showing messages

  • Hi,
    After I have a successful purchase, I am unable to display a message using ShowMessage() in IAPListener.cs. Nothing is displayed and there are no errors:

    switch (id)
                        Debug.Log("I AM INSIDE default");
                        ShowMessage("Skin purchase has been successfully completed.");

    I do see "I AM INSIDE default" in the console windows but I do not see "Skin purchase has been successfully completed." displayed on the screen!?

  • Hello,

    could you upload a screenshot of your ShopManager instance in the scene? It needs a reference to the message window, as seen in the example scenes, which is sorted at the top of your UI (bottom in the canvas hierarchy).

  • @Baroni
    Here is my config:
    [](link url)

  • Thanks for the video. I am not able to find an issue with that, so I'll try to take a guess and explain the workflow more in detail, for you to investigate further:

    • Have a look at your IAPManager prefab. On it, the IAPListener script should be enabled - I expect it is enabled, since you said the event is fired after all
    • ShowMessage() within the IAPListener tries to get a reference to the ShopManager. You can see that happening further down, at ShopManager.GetInstance(). Could you debug whether it returns a reference there? If it does not, it also cannot display a message
    • In case the reference is null, we have to find out why. The IAPManager tells a ShopManager to initialize itself within IAPManager.OnSceneWasLoaded. Please debug whether the method is called, the ShopManager component is found and calls shop.Init().

    To test - always start from the first scene of your app which contains the IAPManager. If you start from the HorizontalTabs sample scene directly, the OnSceneWasLoaded method is not invoked. As written in our documentation, to test the samples you would start from the AllSelection scene.

  • I've edited ShowMessage() to show some debugging messages. For some reason the "instance.errorWindow.SetActive(true);" does not show the window:

    public static void ShowMessage(string text)
                if (!instance.errorWindow)
                    Debug.Log("inside ShopManager.ShowMessage()  !instance.errorWindow condition");
                if (instance.message)   
                    Debug.Log("inside ShopManager.ShowMessage()  instance.message condition:");
                    instance.message.text = text;

    Here is how it looks like:

    [link text] url)

  • Unfortunately I am not able to find of the cause of your issue remotely. Could you please try it out and reproduce it in one of the sample scenes, in a new project, without any and without IAPListener changes? It should work there - then go on with adding your changes until it stops working.

    From this, maybe you'll find out what's the issue behind it. If you can reproduce it in the default sample scene with minimal changes and do not understand why, please zip your project and send it to us via email. Our support email is listed on our website at the bottom, or on the Asset Store page.

  • I found the problem. It was my bad, I had the ShopManager's "error window" referenced the wrong window... It has to reference "window - message".

  • Ah glad you found the problem.

  • Hello,
    I got the same problem. My Message window doesn´t show up. I have only 1 scene wehre I use the IAP system. Inside there are the managers.

    I added a Debug.Log @ IAPManager.OnSceneWasLoaded and I get the log, so it should be loaded.

    The windows are in the right hirarchy (last one of the panels) and the shop manager is setup in the right way.

    I used the prefab in the example (horizontal IAP) and edit the design to my needs. I didn´t do any changes on scripts.

    I also re-importet the shop manager as well as the IAP-Prefab and the window-message-prefab. with the same result: window is not showing.

    When I play the demo scene in a new project, the message window appears.
    Demo scene in the same project: Nope

    I don´t get any errors => No more idea how to solve this. Can anyone help?

  • @AJP-Online solved via email and following up here, your Unity IAP plugin setup was not done correctly i.e. Unity IAP was not installed at all, thus resulting in no callbacks to the message window.

Log in to reply