ノート: スクリーンショットやメニューの選択肢は、リリースバージョンによって異なる場合があります。
ここでは、 In-App Purchasing (IAP、アプリ内課金) を有効にする方法を説明します。
Unity IAP パッケージには、コード化されたアプローチとコードを使わない方法が用意されており、以下を行うことができます。 - ユーザーがゲーム内でアイテムを購入するのを可能にします。 - ストアに接続することで、購入による収益を得ることができます。
以下は、その手順の概要です。
すべてをまとめます。
また、これらの手順の多くを In-App Purchasing API で行ったり、作成したものを微調整することもできます。
ノート: Samsung Galaxy ストアは現在廃止されており、Unity In-App Purchasing パッケージ 4.0.0 以降ではサポートされていません。この Samsung Galaxy ストアの設定ガイドは、IAP パッケージのバージョン 3.1.0 以前にのみ適用されます。Unity IAP パッケージ 4.0.0 以降を使用していて Samsung Galaxy ストアを実装したい場合は、代わりに Unity Distribution Platform を使用してください。
これにより、パッケージマネージャーから IAP パッケージが自動的にインストールされ、IAP を管理するための新しい機能やメニュー項目が提供されます。
プレイヤーが購入するアイテムを作り、その ID を取得します。
これを裏で実現するためには、指定された形式を使用して、プロダクト ID (文字列) を販売する各アイテムに関連付ける必要があります。ストアによっては、プロダクト ID をストア用にカスタマイズする必要があります。
詳しい情報は、Unity Learn IAP クラス を参照してください。
Unity IAP バージョン 2.x から将来のバージョンにアップグレードする場合の重要な注意点
Unity IAP (com.unity.purchase + Asset Store プラグイン) のバージョン 2.x 以降のバージョンにアップデートする場合、コンパイルエラーを解決するために以下の操作を行います。
IAPProductCatalog.json
と BillingMode.json
を Assets/Plugins/UnityPurchasing/Resources/
から Assets/Resources/
に移動します。AppleTangle.cs
と GooglePlayTangle.cs
を ‘Assets/Plugins/UnityPurchasing/generated’ から Assets/Scripts/UnityPurchasing/generated
へ移動します。Assets/Plugins/UnityPurchasing
に残っている Asset Store プラグインのフォルダーとファイルをすべてプロジェクトから削除します。以下のエラーメッセージは Unity IAP が Unity Cloud Services ウィンドウで無効になっているか、Unity がインターネットに接続されていないことを示しています。
* CS0246
* System.Reflection.ReflectionTypeLoadException
* UnityPurchasing/Bin/Stores.dll
* UnityEngine.Purchasing
これらのエラーを解決するには、以下を行います。
Services ウィンドウを閉じて、再ロードします。再ロード後、Unity IAP サービスが有効になっていることを確認します。 これがうまくいかない場合は、インターネットを一度切断して再接続し、Unity Services にサインインして Unity IAP を再度有効にしてください。
ノート: プロジェクトの 所有者 または 管理者 の役割を持っている必要があります。
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.