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. DavidSmit

    DavidSmit

    Joined:
    Apr 1, 2014
    Posts:
    50
    @JeffDUnity3D I tried to recreate the problem with a new project in 2017.4.1f1, but couldn't. Even after removing the library, and the plugins, it seemed to be fine.

    I did notice that if I removed UnityChannel and UnityPurchasing folders from Plugins, and did the import again, I got the proper import structure. While my other project, if I did the same thing, it refused to properly(automatically) install the plugins. It only downloaded the packages, that I had to manually install them. - So I'm guessing that's where the problem started.

    Unsure what went wrong or is wrong with my other project. Perhaps an upgrade from 2017.3 or Git or Mac/Win syncing.
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @DavidSmit Sounds like you are on the right track.
     
  3. kwikdev

    kwikdev

    Joined:
    Jun 13, 2013
    Posts:
    31
    I'm actually seeing it again in 2017.4.1f1 but only on Unity Cloud Build.

    It seems to now work locally after an upgrade and a Library reload, which wasn't true before.

    However, on Unity Cloud Build still see this error for each IAP button:
    780: [Unity] Script attached to 'IAP_Button' in scene 'Scene.unity' is missing or no valid script is attached.

    Tried clearing the cache and that didn't help. UCB is set to 2017.4.1f1 also.

    We do prefer to use the IAP button as it's all set up. The Codeless IAP system is a a nice solution and we definitely want to leverage it.

    However - a simple workaround would be fine. Do you guys know the root cause so we can try some things; or have a clever workaround in mind? This is a strange bug, unlike any I've seen.
     
  4. kwikdev

    kwikdev

    Joined:
    Jun 13, 2013
    Posts:
    31
    Maybe this is a clue, or maybe it's a separate issue:

    When the Unity IAP system is deleted and re-installed it causes a warning about obsolete APIs.

    The upgrade then modifies both UnityPurchasing/Bin/Editor.dll and UnityPurchasing/Bin/Stores.dll files. Screen Shot 2018-04-15 at 7.28.44 AM.png Screen Shot 2018-04-25 at 2.37.10 PM.png
     
  5. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    The API Update is expected when you reimport/install and is required. One work around you might try is to make any edit to IAPButton.cs and push to Cloud Build.
     
  6. kwikdev

    kwikdev

    Joined:
    Jun 13, 2013
    Posts:
    31
    Jeff, I have tried the IAPButton.cs workaround. Created a brand-new script called IAPButton.cs and pasted the contents across. Problem persists.

    I can also still reproduce the missing IAPButton.cs issue in Unity Editor 2017.4.1f1 by detaching / re-attaching my project to Unity Services and re-installing IAP without a Library reload. See attached.

    The error itself doesn't even make sense, "The associated script cannot be loaded. Please check any compile errors and assign a valid script". But there are no compile errors in the Console! Haven't seen this behavior ever before in Unity.

    At this point, here's my understanding:

    1. Unity 2017.4.1f1 is the current long-term Unity release
    2. The Codeless IAP solution does NOT work in 2017.4.1f1
    3. There is no known workaround


    Screen Shot 2018-04-28 at 8.30.12 AM.png
     
    Last edited: Apr 30, 2018
  7. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @kwikdev Codeless IAP is working for me without issue in 2017.4.1f1. And apologies, I didn't mean a new IAPButton.cs script, rather suggesting instead to simply add a new line or similar in the existing file to force it to recompile. Also, does this happen with a new/empty project? Are you testing on a local build? A previous user had a similar issue, and it was because the hard drive folder was marked Read Only where the project was originally saved, and there were no errors in the Console. As a test, try creating/moving the project under the C:\Users\[username]\Documents folder (if on Windows), and try running Unity as an Administrator. Also try importing IAP on a new/empty project, create a Canvas and place a Codeless IAP button.
     
  8. kwikdev

    kwikdev

    Joined:
    Jun 13, 2013
    Posts:
    31
    Do your test projects build successfully on Unity Cloud Build?
     
  9. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Did you follow my instructions previously, editing IAPButton.cs directly to force a recompile? Also, can you test on a new/empty project with only IAP imported and a single Codeless button in the scene? I will test on Cloud Build also.
     
  10. kwikdev

    kwikdev

    Joined:
    Jun 13, 2013
    Posts:
    31
    Yes, on the IAPButton.cs test - this fixes the issue locally but does not stick on Cloud build. Currently I am trying a replacement of IAPButton.cs with a new IAPButtonRad.cs class outside the UnityPurchasing namespace. This seems to compile and may be my workaround.
     
  11. kwikdev

    kwikdev

    Joined:
    Jun 13, 2013
    Posts:
    31
    Hmm, not a fix. Even renaming the class and rewriting it a bit failed for me at runtime after a Cloud build. My conclusion (theory) is that there is *still* some issue deep in the store .dlls and / or the IAPButton.cs class and how they interconnect. Maybe it's specific to my projects, yet I would expect it to affect others in some scenarios.

    Ultimately, as I dug into the IAPButton.cs code and Codeless IAP system, I realized that a "Codeful IAP" solution will serve my needs best long-term. Have rewritten the IAP stuff to suit my needs precisely.

    @JeffDUnity3D - Thank you for working on this issue so diligently. Appreciate it!
     
  12. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    I believe what may be happening on Cloud Build (not confirmed) is that the UNITY_PURCHASING directive may not be defined in the expected order, and is not available at compile time for these files. I am continuing to investigate, but may take a few days.
     
  13. savantedroid

    savantedroid

    Joined:
    Oct 8, 2015
    Posts:
    12
    This problem still continues with 2018.1 and I didn't delete any libraries.
     
    Qbit86 likes this.
  14. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @savantedroid Are you using Cloud Build? Does it build locally?
     
  15. thibouf

    thibouf

    Joined:
    Mar 17, 2017
    Posts:
    105
    Just to confirm, problem still there with Unity 2018.1 in cloud build.
     
    Qbit86 likes this.
  16. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @thibouf can you confirm that it builds locally?
     
  17. thibouf

    thibouf

    Joined:
    Mar 17, 2017
    Posts:
    105
    Yes no problem locally . And removing UNITY_PURCHASING directives still fix the problem on cloud build.
     
  18. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @thibouf Can you elaborate on your statement "And removing UNITY_PURCHASING directives still fix the problem on cloud build". Did you mean to say "still does NOT fix the problem.."?
     
  19. thibouf

    thibouf

    Joined:
    Mar 17, 2017
    Posts:
    105
    No I mean "do fix the problem".

    What I mean, is, like I already said in a previous post, it seems that the directive IS the problem (with cloud build). The MonoBehaviour in the scripts is not found with the UNITY_PURCHASING directive, leading to compilation errors.

    So removing the directive from the files fix the problem (or let's say, it's a workaround), and allow to compile in cloud build.
     
  20. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @thibouf Are you still able to use IAP in the cloud build version of the application, after removing the UNITY_PURCHASING directive? I would not expect IAP to work after removing the directive, and as such, I would not consider it a valid work around. Testing cloud build with IAP is on my task list, hopefully I can confirm the issue soon.
     
  21. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  22. thibouf

    thibouf

    Joined:
    Mar 17, 2017
    Posts:
    105
    @JeffDUnity3D Yes removing UNITY_PURCHASING works, and IAP works, so it IS a valid workaround. (However I hope you will find and fix the actual issue)


    I won' have the time soon to test your project sorry. Anyway, as the problem appears on cloud build, I don't see how me doing it would change anything.
    Also, keep in mind that it seems that this problem is a bit random, and I suspect it might be triggered with bigger projects. On a previous project, it was working right after I integrated IAP, and then it stop compiling after I changed something totally unrelated. Also, I may build on Android and bot on iOs.
     
  23. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    The sooner we have steps to reproduce with a project, the sooner we can identify and hopefully address the problem. I tested Code and Codeless IAP on Cloud Build without issue. We would need a minimal project that reproduces the issue. Also, please provide the Cloud Build logs on a failed build. In the meantime, I might suggest that you try manually defining UNITY_PURCHASING under Player Settings/Other Settings/Scripting Define Symbols
     
    Last edited: Jul 16, 2018
  24. ercion

    ercion

    Joined:
    Aug 15, 2016
    Posts:
    73
    I couldn't add the IAP Button either. When I'd drag and drop the script to add it manually, the editor would tell me that it can't find a MonoBehaviour or the class name doesn't match the file name. I removed the UNITY_PURCHASING directive from IAPButton, let it compile, and added the directive back again, and it started working. Seems to me that when I turned the IAP off, it excluded the class from the project. But it wasn't compiling this class after adding the directive back again.
     
  25. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  26. Qbit86

    Qbit86

    Joined:
    Sep 2, 2013
    Posts:
    487
    I have similar issue not connected to Unity IAP, but probably related to dropping Library/ :
    https://forum.unity.com/threads/unity-fails-to-load-outdated-project.590842/
    Nothing Selected everywhere, no sensible compilation errors.


    Do you have any news on this issue?

    Windows, Unity 2017.2.4, Android, IL2CPP, .NET 4.6.
     
  27. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @Qbit86 Sorry we would only be able to answer IAP questions in this forum, I might suggest the Android forum.
     
  28. xsasoftware

    xsasoftware

    Joined:
    Sep 6, 2017
    Posts:
    24
    I always face this problem.
    Steps to repro:
    1. Make a new project.
    2. Add IAP Buttons
    3. Save on cloud.
    4. Delete project from local disk
    5. Import project from the cloud.
    6. Button scripts error(because missing)

    Am I doing something wrong?
     
  29. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    You likely removed the Library folder or some other needed file. That is likely the issue. If not, then you'll need to do a diff.
     
  30. xsasoftware

    xsasoftware

    Joined:
    Sep 6, 2017
    Posts:
    24
    I will check next time, and come with an answer. ( but all the time when this happen, the iap button scripts are in folders, but are not visible on the "Add Component" menu.
     
  31. negerton

    negerton

    Joined:
    Apr 26, 2017
    Posts:
    7
    @JeffDUnity3D we recently communicated on this in another thread, but in racking my brain trying to solve this issue for nearly two weeks now, I still haven't found a solution.

    I'm able to reproduce this issue in 2019.1.2f1 in a fresh project.
    1. Create a new project
    2. Enable in-app purchasing in Services
    3. Import In-App purchasing package
    4. Create IAPButton object, assign Product ID, save scene and close project
    5. Delete library folder
    6. Re-open project; results in the IAP button reverting to "The associated script can not be loaded" on the IAP button
     
  32. wagenheimer

    wagenheimer

    Joined:
    Jun 1, 2018
    Posts:
    323
    I have the same problem on Unity 2019.1.3f1, when trying to create locally an android build, all IAP Button now shows the error "The Associate Script Cannot be Loaded".

    That is true, this is what happens here!
     
  33. wagenheimer

    wagenheimer

    Joined:
    Jun 1, 2018
    Posts:
    323
    Another problem. IAPListener does not appears on Add Component.
    But I can find it searching for it on the project. But I still cannot add it to a gameobject.

    upload_2019-5-24_11-11-52.png
     
  34. xsasoftware

    xsasoftware

    Joined:
    Sep 6, 2017
    Posts:
    24
    I have the same problem.
     
  35. wagenheimer

    wagenheimer

    Joined:
    Jun 1, 2018
    Posts:
    323
    I was able to fix it, but I'm not sure what I have done. But I'm sure It's something wrong with the #define not working as expected!
     
  36. Luchunpen_0

    Luchunpen_0

    Joined:
    Aug 7, 2014
    Posts:
    58
    2019.1.4f - same problem.
    After compile IAPButtons are missing scripts
     
  37. negerton

    negerton

    Joined:
    Apr 26, 2017
    Posts:
    7
    @JeffDUnity3D any more updates on this? it's clear that the issue is not resolved.

    I'm not trying to come off as inflammatory, or to hold your feet to the fire; I know dev priories are what they are and things change. But with that said, on January 18 2018 you mentioned this was being investigated as a high priority; then, 3 months later, it was said to be fixed. As per the responses here, and the test I outlined above, this is clearly still an issue; the underlying problem of this plugin being heavily dependent on the Library folder has not been addressed.

    I understand git/version control is outside the scope of your support, but at the same time, Unity surely must recognize that such a thing is common practice among unity devs of all professional/skill levels. This plugin being fundamentally not compatible with GIT is problematic, time consuming, and risky; and the likely outcome barring a fix here is I'll simply have to find another plugin to use. This is rather disappointing, as I like Unity's IAP solution otherwise.

    I suppose what I'm saying is that it would be helpful to know if there are currently no plans to address this issue, as I can begin searching for (or developing) another solution.
     
    Meatloaf4 likes this.
  38. Luchunpen_0

    Luchunpen_0

    Joined:
    Aug 7, 2014
    Posts:
    58
    I think my problem has the same reason. I transmit project by GIT with typical .gitignore (Library folder is excluded) and get it, then remove and reinstall plugin and it worked.
     
  39. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    I swear we had this fixed previously, my mistake if not. I've had users send me projects with the Library folder removed before zipping, and the project worked. Hmm...perhaps I had always immediately updated IAP to the latest version, which may have masked the issue and certainly not a work around here. At any rate, it sounds like it's back/still here. Agreed, the Library folder can become VERY large, and ideally ignored in source control.
     
    Meatloaf4 likes this.
  40. negerton

    negerton

    Joined:
    Apr 26, 2017
    Posts:
    7
    Thanks for the response. @JeffDUnity3D

    Yes, immediately removing/reimporting Unity IAP will mask the issues in some ways - as it will cause IAP buttons to properly compile as IAP objects. However, while this method serves to properly re-link the IAP scripts to the intended objects, button-specific settings are not preserved (SKU, type of button, etc.) and need to be reconfigured (while overall catalog details ARE preserved).

    It seems those particular settings are contained within the assetDatabase3 file within the library folder, as the issue can be reproduced by simply removing that file. Or, perhaps the serialized data is lost when the plugin is re-imported from this state?
     
  41. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Undetermined, but I have already reported this issue here. Hopefully it will get some attention. However, it looks like something may have changed in the Editor, and unfortunately Editor issues can take a longer time to address due to QA and integration testing. But not certain yet.
     
  42. etherny1234

    etherny1234

    Joined:
    Mar 10, 2015
    Posts:
    3
    @JeffDUnity3D any news about this issue ?
    I have the same problem using iapbutton (with codeless)
    Works locally but when repo pulled on another computer I have a missing behaviour on button.
    I m using 2019.1.7f1 version.

    IAPButton.cs is present in the git re^po and pulled on clone.

    I can add new IAPButton on the second computer in editor without issue, but IAPButton added by the first computer (who push the code to the git repo) and pulled by second not working.

    It's the same issue than on Unity Cloud but on my personnal gitlab ci.
     
    Last edited: Jun 22, 2019
  43. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  44. Puschie

    Puschie

    Joined:
    Feb 16, 2013
    Posts:
    7
    missing IAPButton reference problem still exist...
    workaround:
    a. add UNITY_PURCHASING to Scripting Define Symbols
    b. removing the UNITY_PURCHASING directive from IAPButton.cs

    after one day of investigation we found that somehow all ( except the one ) buttons lost their iap button script reference...
    doesnt work:
    - reinstall iap
    - remove and recreate buttons
    - clean repo pull and build
    - reinstall unity ( also tried different versions )

    im not sure how it happen, we re-create our menu and recreated the iap buttons and after that point it was broken

    app crash:

    The file '/data/app/***/base.apk/assets/bin/Data/level2' is corrupted! Remove it and launch unity again!
    [Position out of bounds!]

    callstack:
    Code (js):
    1.  
    2. DEBUG: backtrace:
    3. DEBUG:     #00 pc 00042000  /system/lib/libc.so (tgkill+12)
    4. DEBUG:     #01 pc 0003fc0d  /system/lib/libc.so (pthread_kill+32)
    5. DEBUG:     #02 pc 0001c393  /system/lib/libc.so (raise+10)
    6. DEBUG:     #03 pc 00142d13  /data/app/***/lib/arm/libunity.so (_Z40DebugStringToFilePostprocessedStacktraceRK21DebugStringToFileData+562)
    7. DEBUG:     #04 pc 00143019  /data/app/***/lib/arm/libunity.so (_Z17DebugStringToFileRK21DebugStringToFileData+252)
    8. DEBUG:     #05 pc 0053fd9f  /data/app/***/lib/arm/libunity.so (_ZN12CachedReader16OutOfBoundsErrorEjj+310)
    9. DEBUG:     #06 pc 0054002d  /data/app/***/lib/arm/libunity.so (_ZN12CachedReader15UpdateReadCacheEPvj+30)
    10. DEBUG:     #07 pc 0013f921  /data/app/***/lib/arm/libunity.so (_ZN18StreamedBinaryRead21TransferSTLStyleArrayIN4core12basic_stringIcNS1_20StringStorageDefaultIcEEEEEEvRT_17TransferMetaFlags+24)
    11. DEBUG:     #08 pc 00401fd1  /data/app/***/lib/arm/libunity.so (_Z15Transfer_StringI18StreamedBinaryReadLb0EEvRK29SerializationCommandArgumentsR31RuntimeSerializationCommandInfo+56)
    12. DEBUG:     #09 pc 0040851d  /data/app/***/lib/arm/libunity.so (_Z28ExecuteSerializationCommandsI18StreamedBinaryReadEvR28SerializationCommandProviderRT_RK17GeneralMonoObject+92)
    13. DEBUG:     #10 pc 00400c23  /data/app/***/lib/arm/libunity.so (_Z23TransferScriptingObjectI18StreamedBinaryReadEvRT_18ScriptingObjectPtr17ScriptingClassPtrRPN18SerializationCache4DataE+210)
    14. DEBUG:     #11 pc 00420291  /data/app/***/lib/arm/libunity.so (_ZN33ManagedObjectHostTransferRedirectI13MonoBehaviourE8TransferERS0_R18StreamedBinaryRead+40)
    15. DEBUG:     #12 pc 00a869bb  /data/app/***/lib/arm/libunity.so (_ZN14SerializedFile10ReadObjectEx18ObjectCreationModebPPK8TypeTreePbR6Object+470)
    16. DEBUG:     #13 pc 003f72fb  /data/app/***/lib/arm/libunity.so (_ZN17PersistentManager29ReadAndActivateObjectThreadedEiRK26SerializedObjectIdentifierP14SerializedFilebbNS_9LockFlagsE+214)
    17. DEBUG:     #14 pc 003f77c9  /data/app/***/lib/arm/libunity.so (_ZN17PersistentManager26LoadFileCompletelyThreadedERKN4core12basic_stringIcNS0_20StringStorageDefaultIcEEEEPxPiiNS_9LoadFlagsER12LoadProgressNS_9LockFlagsE+524)
    18. DEBUG:     #15 pc 00562575  /data/app/***/lib/arm/libunity.so (_ZN18LoadSceneOperation7PerformEv+1044)
    19. DEBUG:     #16 pc 00563c23  /data/app/***/lib/arm/libunity.so (_ZN14PreloadManager22ProcessSingleOperationEv+38)
    20. DEBUG:     #17 pc 00563ad9  /data/app/***/lib/arm/libunity.so (_ZN14PreloadManager3RunEv+48)
    21. DEBUG:     #18 pc 00563a83  /data/app/***/lib/arm/libunity.so (_ZN14PreloadManager3RunEPv+18)
    22. DEBUG:     #19 pc 0045e6fd  /data/app/***/lib/arm/libunity.so (_ZN6Thread16RunThreadWrapperEPv+472)
    23. DEBUG:     #20 pc 0003f50f  /system/lib/libc.so (_ZL15__pthread_startPv+30)
    24. DEBUG:     #21 pc 00019c93  /system/lib/libc.so (__start_thread+6)
    25.  
     
    Last edited: Dec 2, 2019
  45. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    The error does not look related to IAP. If you believe it is related, we would need specific steps to reproduce.
     
  46. mskalash

    mskalash

    Joined:
    Oct 24, 2016
    Posts:
    5
    How you fix this ? I have this problem too.
     
  47. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Please describe your issue.
     
  48. mskalash

    mskalash

    Joined:
    Oct 24, 2016
    Posts:
    5
    I created a project.
    Added IAP.
    Added several products.
    Created a panel with IAP buttons.
    Assembled a project for iOS.
    After launch, the application crashes with an error:
    The file '/ Data / level1' is corrupted! Remove it and launch unity again!
    [Position out of bounds!]
    (Filename: Line: 220)
    After that, I removed the panel with buttons and everything worked fine
    Unity 2019.4.10f1
     
  49. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Please compare with the Sample IAP Project here. Don't use Codeless for now, use Scripted IAP. We are working to improve the Codeless implementation https://forum.unity.com/threads/sample-iap-project.529555/
     
  50. John_Corbett

    John_Corbett

    Joined:
    May 17, 2019
    Posts:
    151
    Hi Puschie and mskalash,

    Have you enabled Purchasing in the Service WIndow (Ctrl + 0)?

    I know this is probably the case, but if not, make sure you're connection to the Services is correct, and that you have set your COPPA settings correctly.
     
Thread Status:
Not open for further replies.