I am going crazy, every time I need to update the sdk I have to spend days to understand what breaking change did break the abstraction layer I wrote.
I updated to Unity IAP 4.12.2 and the plugin never finish the initialization if I use the UnityServices.InitializeAsync method, OnInitialized never gets called.
It doesn’t fail, it just doesn’t get called at all.
You should report a bug.
Since the source code is readily available, I usually just step into the method to see if the Invoke runs or not, and if not, why not.
I’ve commonly seen devs do something like “call method” and then “subscribe event” when it should be the other way around. If the method call completes instantaneously you won’t get the initialize event merely because of that.
When I debug it doesn’t go into the built in package source. How do I enable debugging on the built in packages?
I am using Visual Studio, but I can try with VS Code if needed.
Hmmm maybe you didn’t do a “step into”? VS should be able to debug package code.
Check if any breakpoint hits, in case the debugger isn’t properly attached.
It is enabled. Maybe the part I was skipping into was part of a dll, don’t know.
Found the issue. It seem the old initialization code which was working fine before doesn’t work anymore.
I was calling InitializeAsync from one of my internal methods, and it was complaining I wasn’t calling from the main thread. Can’t remember exactly the whole workflow of that method.
To fix it I had to move the UnityService.InitializeAsync inside the start method exactly as the example provided.
Now it works normally, however there is some bug in the IAP plugin as it shouldn’t die silently without any fail message.