Search Unity

IAP Button goes missing...

Discussion in 'Unity IAP' started by Deleted User, Nov 6, 2017.

Thread Status:
Not open for further replies.
  1. Deleted User

    Deleted User

    Guest

    I am using Unity 2017.2. I am using Unity's Codeless IAP Buttons. I can import the IAP Buttons and add them just fine.

    However, if I leave the Scene and come back, the IAP Button component is replace with the empty compoennt of "Nothing Selected". If I reimport Unity IAP without leaving the Scene, the IAP Buttons come back. But as soon as I leave the scene and return, they are gone again.

    When clicking on the script, it says "No MonoBehaviour scripts in the file, or their names do not match the file name." in the inspector. But IAPButton is a MonoBehaviour, and there are no typos in the script name nor class name.

    I have tried publishing with the brokenness, but the buttons do not appear to do anything.

    What is going on here, and how can I fix it?
     
    Last edited by a moderator: Nov 6, 2017
    Mccbbi likes this.
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Can you elaborate regarding "reimport Unity IAP without leaving the scene"? Do you mean leave the scene when in the Editor, or when playing the game.
     
  3. Mccbbi

    Mccbbi

    Joined:
    Feb 8, 2015
    Posts:
    12
    Same here.
    I have grid layout with 5 products and iap buttons inside each. When i start the game in editor, all iap button scripts just dissapear, except the first button.
     
  4. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    @Evorlor, @mccbbi

    I have not been able to reproduce this issue in 2017.2. Would you be able to share a project where this is happening?

    Can you make sure that the Purchasing service is still enabled in your project?
    Also, are there any compiler errors or other error messages in the console?
     
  5. thibouf

    thibouf

    Joined:
    Mar 17, 2017
    Posts:
    105
    Hello,

    I have a bug quite similar with 2017.2, I cannot find the origin.
    It works well in unity for me , but when I build using cloud build, all IAPButton scripts goes missing.

    When I say missing , I mean the MonoBehaviour link in my objects seems lost , I get errors in log in running :

    But no compilation error.
    Also,I made a script to test if the class was compiled using reflection, and the answer is yes :
    Last thing, I have noticed that the script file IAPButton.cs had the message
    Very strangely, i just edited the file and CTRL-Z, and the message went away.

    Could that be a bug with unity not recognizing well the MonoBehaviour in the file for some strange reason ?
     
  6. thibouf

    thibouf

    Joined:
    Mar 17, 2017
    Posts:
    105
    Hey just a little follow up . I have duplicated the IAPButton class to make my own, and got the exact same problem.

    A fix that seems to work for me is to remove the #if UNITY_PURCHASING directive. Now the script works fine, event in cloud build.

    So just to be clear, it seems that
    - The UNITY_PURCHASING compilation constant is defined
    - The class is fully compiled (i have checked that)
    - When built the class is missing from serialized objects

    @ap-unity I dont have the time to make a small project to reproduce and I am not even sure it will reproduce the bug as it seems random. But I highly suspect that something is randomly wrong with the #if UNITY_PURCHASING and the ability of unity to recognize the MonoBehaviour inside it, even when defined.
     
    Qbit86 and ardimh_7 like this.
  7. Deleted User

    Deleted User

    Guest

    @ap-unity @JefffDUnity3D

    Sorry for late reply. I was expecting an email if someone responds to threat, but never got one. I thought it went ignored.

    @thibouf 's Answer seems like it could work. I am still doing some testing, but the problem is probably within there. I will let you know if it persists, even with #if UNITY_PURCHASING commented out.
     
  8. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Editing the files should not be necessary. I just created a simple project using Unity 2017.3.0b9 and IAP 1.14.1 and dropped 3 IAP Buttons into the scene. They remain visible when I run the project. If possible, please provide exact steps so that we can reproduce the issue here.
     
  9. stansison

    stansison

    Joined:
    Feb 20, 2016
    Posts:
    28
    I am facing the same issue. IAP Button goes missing and is described to have no MonoBehaviour connected. Using the windows menu allows you to add a new one. Loading from the file tho causes a potential issue where the button may disappear again.
     
  10. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Please test with 2017.1 and 2017.3 and see if the issue persists. There may be an issue with the UNITY_PURCHASING directive on 2017.2.
     
    stansison likes this.
  11. GroznyBear

    GroznyBear

    Joined:
    Oct 16, 2015
    Posts:
    4
    I faced with similar problem, but in my situation that this bug is appear after Unity's crash (it is crashing sometimes). I'm using Unity 2017.2 on MacOS. Also, under the Player Settings -> Scripting Define Symbols there is no UNITY_PURCHASING directive, but UNITY_INAPPS is there. I added UNITY_PURCHASING manually, but seems that didn't help.
     
  12. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @GroznyBear Please test with 2017.1 or 2017.3. There may be an issue with the UNITY_PURCHASING directive on 2017.2.
     
  13. cokagamesstudios

    cokagamesstudios

    Joined:
    Nov 10, 2016
    Posts:
    5
    Face this problem in 2017.2. Reinstall unity 2017.1, delete library folder and re-open the game is fixed for me
     
  14. kwikdev

    kwikdev

    Joined:
    Jun 13, 2013
    Posts:
    31
    In 2017.3.0f3 I see issue similar to what @stanison says about "IAP Button goes missing and is described to have no MonoBehaviour connected." This occurred when upgrading existing projects from 5.6.3.

    The specific, very weird error, is the IAPButton class is broken with non-compile error. BUT, everything has compiled fine with no Console errors at all. The game runs, with only warnings about the uncompiled script. See the screenshot if this seems crazy.

    I've tried: deleting Library folder; deleting and re-importing the latest Unity Purchasing; looking at the IAPButton in MonoDevelop (it compiles fine, see screenshot). Also a brand-new project importing the Unity Purchasing does not fail.

    Currently: my setup is one master repo, with 2 nearly identical branches. Working in one of the branches, I fixed the issue (somehow, unclear steps), but merging back to the master does not resolve the problem.

    NOTE: My repo has a master and 2 nearly identical branches; working in one of the branches I managed to solve this but I don't know why it suddenly started working. Still looking...
     

    Attached Files:

    Last edited: Dec 25, 2017
  15. kwikdev

    kwikdev

    Joined:
    Jun 13, 2013
    Posts:
    31
    This was real weird, but to solve it I copied the entire project MANUALLY from the branch and dropped it over the master. There was not a single change in git, BUT it magically started working. ??? Guess it may have been a bad asset somewhere, maybe in the cache server or somewhere outside the Assets folder which is not part of the git commits. Good luck to anyone who sees this!

    EDIT: Seems to have broken down again!
     
    Last edited: Dec 31, 2017
    Qbit86 likes this.
  16. svwillia

    svwillia

    Joined:
    Aug 28, 2014
    Posts:
    48
    Hello,

    I have not been able to correct this issue. Every time I build the project, it breaks and shows the empty component issue.
     
  17. kwikdev

    kwikdev

    Joined:
    Jun 13, 2013
    Posts:
    31
    Creating a brand-new .cs file and pasting the contents from the IAPButton.cs script fixed the compile problem for me. The script also had a weird "gem icon" that disappeared. I suspect some type of corruption in the file itself. In git it showed modified but with NO changes to the script; only changes to the metafile.
     
  18. thibouf

    thibouf

    Joined:
    Mar 17, 2017
    Posts:
    105

    @JeffDUnity3D
    I am still having this issue with 2017.0.3
    Do you have any more information about this problem ?
     
  19. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Sorry, I don't have further information. You mentioned that commenting out #if UNITY_PURCHASING directive was working for you (which shouldn't be necessary). If you continue to have issues, please provide a simple project that reproduces the problem. You can submit the project in a support ticket which you can create at https://analytics.cloud.unity3d.com/support
     
  20. kwikdev

    kwikdev

    Joined:
    Jun 13, 2013
    Posts:
    31
    Every time I delete my Library, the IAPButton stops compiling. This occurs in multiple projects. Each time it can be restored by editing and recompiling the script.

    Note that this is a specific, bizarre problem, since everything DOES compile, and the project runs in Editor with missing behavior errors. Yet it states that IAPButton has not compiled. But then, by editing IAPButton.cs in any way, it recompiles and works as expected. See screenshots in my post above.

    PS. The UNITY_PURCHASING directive doesn't seem to be involved in my case.
     
    Last edited: Jan 2, 2018
  21. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @kwikdev Please provide steps so that I can reproduce on a new project.
     
  22. thibouf

    thibouf

    Joined:
    Mar 17, 2017
    Posts:
    105
    @JeffDUnity3D I will try but it is quite hard to make a reproducible project as the issue seems a bit random .. For example, in my own project it was working fine, then I don't understand why it started to not work anymore at one point ...

    And I confirm that removing UNITY_PURCHASING fixed the problem for me...
     
  23. thibouf

    thibouf

    Joined:
    Mar 17, 2017
    Posts:
    105
    Ah also, i had the problem only in builds made with Unity Cloud Builds, on my local machine, it was fine ... (so it's even harder to create a sample reproducible project ...)
     
  24. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    I hate to not provide insightful information regarding this problem but it is happening to me.

    I am using 2017.2.0f3 and I don't use the directive in my code.

    This is how I think this issue originated.

    I had my 2017.2 project with codeless IAP buttons working as expected, I even built for iOS to test these buttons and they worked fine. I also let Unity run for over a week while randomly using my Mac laptop for other stuff, though Unity remained open with this project loaded.

    Then I decided it was time to set a VCS to sync between my Mac and pc.

    - Copied my project to another folder to be tracked with bitbucket on my pc.
    - I uploaded my project to bitbucket using SourceTree
    - IAP buttons show 'nothing selected' in their respective component section in the inspector window.
    - To solve this I created a placeholder IAP codeless button, copy and paste the IAP Button component of that placeholder IAP codeless button into my real IAP buttons and set things up.
    - problem occurs as soon as I close Unity and open same project back again: 'nothing selected'. I also get console warnings that arise from this issue on my Mac and pc.

    These are:
    - The referenced script on this Behaviour (Game Object 'IAP restore') is missing!
    - The referenced script on this Behaviour (Game Object 'IAP purchase') is missing!

    Foolishly deleted the original project so the BitBucket project is all I have though this is the only issue I have.

    UPDATE:
    After opening the project again I noticed the placeholder IAP codeless button is now also showing in its component section in the inspector 'nothing selected'. Note that the Image and Button component do show correctly.

    Unity please help!
     

    Attached Files:

    Last edited: Jan 5, 2018
    Qbit86 likes this.
  25. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    My .gitignore file looks like this:

    .DS_Store
    Library
    Temp
    *.csproj
    *.pidb
    *.unityproj
    *.sln
    *.userprefs
     
  26. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    @JeffDUnity3D Can you please take a look at my posts?
    Thanks
     
  27. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @gegagome Sorry I'm not sufficiently familiar with your source control system to spot any issues. Someone said earlier that removing the Library folder caused issues, and I noticed it is in your gitignore. Also, please try with 2017.3 as 2017.2 had some issues with the UNITY_PURCHASING directive as mentioned in earlier posts.
     
  28. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    I have confirmed that deleting the Library folder (or using gitignore or similar for the Library folder) is not good for Codeless IAP and causes the scripts not to load. I have let the IAP team know.
     
    Last edited: Jan 5, 2018
    Qbit86 likes this.
  29. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    @JeffDUnity3D So it looks like my issue was clearly moving the project between folders to get it ready for BitBucket.

    I built and tested my IAP buttons in late November and early December using 2017.2

    I updated my project to 2013.3.0f3 and the buttons are still gone, but at least they are saved after I quit Unity.

    So my educated guess is: 'nothing selected' began happening after pasting (I think I did this but I am not sure if I moved the actual folder to a different location, shoot my memory) the files of my project to another folder.
     
  30. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    For now, you may have to start a new project and reimport your assets (if removing the UNITY_PURCHASING directive in the script file doesn't work for you). And don't set the gitignore flag for the Library folder.
     
  31. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    @Evorlor, @mccbbi, @thibouf, @stansison, @GroznyBear, @cokagamesstudios, @kwikdev, @gegagome

    We have been able to reproduce the following scenario in 2017.2 and 2017.3.

    1. Create new project, import IAP and create a Codeless IAP button
    2. Close project and delete Library folder
    3. Open project and the IAPButton script will be missing (as shown in this post's screenshot)

    There is no reason for this to be tied so tightly to the Library folder (and it is often suggested to ignore the Library folder in source control), so this is a bug we will need to resolve.

    As a temporary workaround, you should be able to add the following directory and file to your source control (or make sure they are copied whenever you move your project).

    /Library/metadata/
    /Library/assetDatabase3

    If your project is currently in this state, you will need to reinstall Unity IAP and re-add the IAP Buttons.

    To do so, you must delete the following directories:
    /Plugins/UnityChannel/
    /Plugins/UnityPurchasing/

    Then after reimporting the IAP plugin, you can remove the broken IAPButton components and re-add them.

    I apologize for this inconvenience. If this does not resolve the issue for you, please provide the necessary steps to reproduce your case.
     
    Tolpak and Qbit86 like this.
  32. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    You should check that all the IAPButtons in your scene have the product IDs set correctly. The product IDs would need to be configured in the IAP catalog first. (And if you needed to reinstall Unity IAP, then they may need to be reconfigured.)
     
    gegagome likes this.
  33. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    @JeffDUnity3D @ap-unity
    It was the placeholder IAP button (from where I got the IAP Button component to paste it to the 'nothing selected' IAP buttons) that I forgot to delete.

    I removed my original post as to avoid confusions.

    Hopefully my IAP codeless buttons will stick around.

    Thanks
     
  34. kwikdev

    kwikdev

    Joined:
    Jun 13, 2013
    Posts:
    31
    @ap-unity Thanks for providing these solutions. The Library definitely seemed to be involved in the problems I was seeing, your repro steps make sense. Notably, I also got the script to re-compile simply by editing and saving the IAPButton.cs file.
     
  35. tarmo-jussila

    tarmo-jussila

    Joined:
    Jun 4, 2015
    Posts:
    42
    Removing and reimporting the Unity IAP plugin fixed the issue for me locally. This is a really annoying issue, though.

    Is there any estimate when this bug will be fixed?
     
  36. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @tarmo-jussila We are working on it at high priority, you should see improvements in an upcoming version. IAP plugin development needs to coordinate with ongoing Editor releases, so we can't always release separately.
     
    tarmo-jussila likes this.
  37. tarmo-jussila

    tarmo-jussila

    Joined:
    Jun 4, 2015
    Posts:
    42
    Is there an issue tracker for this issue? Which upcoming version is the fix coming in?
     
  38. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    We are still investigating, no ETA yet. I don't believe there is an external facing issue, I will check with engineering and get an update, and will reply here when I have additional information to share.
     
  39. kwikdev

    kwikdev

    Joined:
    Jun 13, 2013
    Posts:
    31
    @JeffDUnity - we just updated to the newest IAP in Unity 2017.3.1f1. Is the fix expected to be in place for this setup?

    I ask because the non-compiled IAPButton still recurs every time we delete the Library folder.

    We're hoping to find a fix or workaround that can be applied on Unity Cloud Build too. Thanks!
     

    Attached Files:

  40. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    I don't believe we have addressed the issue yet of removing the Library folder, no ETA yet at this time. You've tried the work around of editing and saving the file?
     
  41. kwikdev

    kwikdev

    Joined:
    Jun 13, 2013
    Posts:
    31
    Thanks for the news.

    Yes, the edit / save works to re-compile locally. Unfortunately, on Unity Cloud Build it breaks since the Library is re-created there. Do you have a workaround method for UCB? Checking the entire Library in comes to mind; but that's kind of extreme. If it's fixed in 2018 we'd jump there to fix this.
     
    Last edited: Mar 2, 2018
  42. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    unityjingyao and ap-unity like this.
  43. kwikdev

    kwikdev

    Joined:
    Jun 13, 2013
    Posts:
    31
    Excellent! In 2017.3.1p2, it does appear fixed. Thanks, Jeff!
     
    Last edited: Apr 12, 2018
  44. kwikdev

    kwikdev

    Joined:
    Jun 13, 2013
    Posts:
    31
    Somehow, some way this bug has resurfaced in Unity 2017.3.1p4

    It seems to have the same repro steps. It's still a bizarre error where IAPButton.cs does not compile, but otherwise everything in Unity is fine.

    Jeff, am I seeing things, or has the fix slipped back out?
     

    Attached Files:

    Qbit86 and aurelienpic like this.
  45. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @kwikdev Can you provide specific steps to reproduce in your case? Did you delete the Library folder for example? Also, what version of IAP are you using (check the top of the Changelog file in Assets/Plugins/UnityPurchasing)
     
  46. kwikdev

    kwikdev

    Joined:
    Jun 13, 2013
    Posts:
    31
    I believe the steps outlined by ap-unity above are still accurate:

    1. Create new project, import IAP and create a Codeless IAP button
    2. Close project and delete Library folder
    3. Open project and the IAPButton script will be missing

    As we use Unity Cloud Build exclusively, the Library is cleared and this issue always occurs.

    This is the most recent version in the Changelog:
    ## [1.18.0] - 2018-03-27

    We're using the latest Unity available, which seems to be 2017.3.1p4, but would upgrade to any version where this is fixed. Is 2017.4 available to developers yet?
     
    Last edited: Apr 16, 2018
  47. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  48. kwikdev

    kwikdev

    Joined:
    Jun 13, 2013
    Posts:
    31
    Thank you, I had never found the LTS builds. Yes, this is fixed in 2017.4.1f1
     
    Last edited: Apr 18, 2018
  49. DavidSmit

    DavidSmit

    Joined:
    Apr 1, 2014
    Posts:
    50
    I'm also running 2017.4.1f1, and for me it disappeared again. At least one of them is.
    Initially one button (of the 4 I have) just kept losing track of the iAP product ID, but now the script is lost again on this button.

    Edit: On build or play it goes missing on 3 of the 4 buttons.

    There is also no way to add the script manually on an existing game object with 'Add Component'. It doesn't exist there, you have to use the top-menu to create it. Not sure if that's related, but it seems strange.

    I guess not using the IAP button is the best strategy for now.
     
    Last edited: Apr 22, 2018
  50. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @DavidSmit If you could provide steps for us to reproduce on a new/empty project, it would be appreciated. This issue should be resolved for the general case, you might have something else going on.
     
Thread Status:
Not open for further replies.