Unity 2020.2.1f1: Codeless IAP Buttons reset every time I open any project

Hello world,

I recently updated to Unity 2020.2.1f1. Now all the projects that used the codeless IAP feature before, have an issue with loading the IAP button preferences.

Every time I open a project, the following warning shows in the console and I have to REINSTALL the unity purchasing package and manually reset all IAP buttons.

This is what the IAP button should look like in the editor:
6728122--774394--upload_2021-1-15_15-40-18.png

This is what the IAP button looks like after opening the project:
6728122--774385--upload_2021-1-15_15-32-0.png

I checked and the the referenced script (UnityEngine.Purchasing.IAPButton) on this Behaviour is actually NOT missing! As far as I know, all associated IAP files still are in their directories.
This is the referenced “IAPButton” script that shows up normally in the folder:
6728122--774388--upload_2021-1-15_15-35-10.png

I also discovered that when reinstalling the unity purchasing package, then revert to an older version of the project through unity collaborate, and then revert back to the new one, the preferences are back. However, it would be very nice if I didn’t have to do that every time I opened my projects using unity IAP.

Are you using Collaborate? Please compare to a local-only project. It appears we lose that reference if the /Library folder is not sync’d as when using source control, which would be a bug. We plan to address this in the April/May timeframe with IAP 3.0 where we are going to a single Package Manager component.

I’ve been having this problem as well. How should we fix it until you get around to it in April/May?!

Yes, I am using collaborate. This is probably the issue.

I guess until then we will have to reset the IAP preferences ourselves by reinstalling the IAP package and reassigning the IAP buttons manually

Could you please tell us exactly where in the Library folder we should add syncing across source control so we can prevent this issue? Using the entire folder seems like overkill so it’d be nice if we could have a description of what to sync. This issue is honestly giving me headaches every single day because I develop across a few different branches and platforms, between IAP-supported mobile and non-IAP-supported-desktop, so it’s driving me nuts.

Please add UNITY_PURCHASING as a custom script define in Player Settings/Other Settings. This internal define goes missing in some cases and results in the errors that you are seeing, and adding it manually should resolve the issue. It’s due to script compilation order, and should go away when we move to an all Package Manager version of IAP soon that doesn’t require the define.

2 Likes