Adding a button to restore purchases
On platforms that support it (Google Play and Universal Windows Applications, most notably), if you purchase something, uninstall, and then reinstall a game using Unity IAP, it automatically restores any products the user owned during the first initialization following reinstallation.
For those on iOS, users must have the ability to restore their purchases via a button due to Apple requiring them to reauthenticate their password beforehand. Not doing so will prevent our game from being accepted on the iOS App Store, so it’s a good idea to include this functionality if we wish to deploy it there. Let’s look at the steps to do just that:
- Go to the Hierarchy window and select the Remove Ads Button object. Once selected, duplicate it by pressing Ctrl + D.
- Change the duplicate’s name by selecting it and changing its name to
Restore Button
in the Inspector window. - From the Hierarchy window, open up the Text object...