> For the complete documentation index, see [llms.txt](https://onestore-dev.gitbook.io/dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://onestore-dev.gitbook.io/dev/chi/tools/billing/v21/unitymig.md).

# 在Unity升级至IAP SDK v21

### 更新Unity用v21 Library文件

{% hint style="info" %}
如果只更换Library文件，IAP SDK v21新提供的多次购买、订阅等功能将无法使用。
{% endhint %}

#### 删除v19 Library文件。 <a href="#id-zai-unity-sheng-ji-zhi-iapsdkv21-shan-chu-v19library-wen-jian" id="id-zai-unity-sheng-ji-zhi-iapsdkv21-shan-chu-v19library-wen-jian"></a>

| **Assets > Plugins > Android** | <p>· iap\_sdk-v19.00.xx.aar<br>· iap\_adapter-v1.x.x.aar</p> |
| ------------------------------ | ------------------------------------------------------------ |
| **Assets > StreamingAssets**   | · global-appstores.json                                      |

#### 从AndroidManifest.xml中删除元素 <a href="#id-zai-unity-sheng-ji-zhi-iapsdkv21-cong-androidmanifest.xml-zhong-shan-chu-yuan-su" id="id-zai-unity-sheng-ji-zhi-iapsdkv21-cong-androidmanifest.xml-zhong-shan-chu-yuan-su"></a>

Assets > Plugins > Android > AndroidManifest.xml

删除ProxyActivity和 iap\_version元数据。

```xml

<manifest>
<application>
        <activity android:name="com.gaa.sdk.iap.ProxyActivity"
android:configChanges="locale|fontScale|keyboard|keyboardHidden|layoutDirection|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>

         <meta-data android:name="iap:api_version" android:value="6"/>
...
</application>
</manifest>

```

#### [添加v21 Library文件。](https://github.com/ONE-store/unity_plugins/tree/archive) <a href="#id-zai-unity-sheng-ji-zhi-iapsdkv21-tian-jia-v21library-wen-jian" id="id-zai-unity-sheng-ji-zhi-iapsdkv21-tian-jia-v21library-wen-jian"></a>

将Library文件添加到下面的文件夹。

| **Assets > Plugins > Android** | <p>· sdk-base-v1.0.0.aar<br>· sdk-auth-v1.0.1.aar<br>· sdk-iap-v21.00.00.aar<br>· sdk-configuration-kr-v1.0.0.aar<br>· iap-unity-adapter-v2.0.0.aar</p> |
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- |

### 为使用IAP SDK v21新功能进行升级

#### 删除v19 ".unitypackage"中添加的文件

| **Assets > Plugins > Android**  | <p>· iap\_sdk-v19.00.xx.aar<br>· iap\_adapter-v1.x.x.aar</p>                                                                                  |
| ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| **Assets > Scripts > Purchase** | <p>· GaaIapCallManager.cs<br>· GaaIapCallbackManager.cs<br>· GaaIapResultListener.cs<br>· GaaIapPurchaseResponse.cs<br>· AndroidNative.cs</p> |
| **Assets > StreamingAssets**    | · global-appstores.json                                                                                                                       |

#### 从AndroidManifest.xml中删除元素

Assets > Plugins > Android > AndroidManifest.xml\
删除ProxyActivity和iap\_version元数据。

```
<manifest>
    <application>
         <activity android:name="com.gaa.sdk.iap.ProxyActivity"
                  android:configChanges="locale|fontScale|keyboard|keyboardHidden|layoutDirection|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode"
                  android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
 
         <meta-data android:name="iap:api_version" android:value="6"/>
        ...
    </application>
</manifest>
```

#### 删除GameObject

删除GaaIapCallbackManager 游戏对象。 应用了 v2的Unity Plugin，无需手动添加 GameObject 。<br>

<figure><img src="/files/torDoLYrSwtI6eYv2rKl" alt=""><figcaption></figcaption></figure>

\
如果执行了上述所有操作,在应用IAP SDK v21之前已经做好了事前准备。\
现在可以参照 [在Unity使用One store In-App支付](/dev/chi/tools/billing/v21/unity.md)指南使用即可。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://onestore-dev.gitbook.io/dev/chi/tools/billing/v21/unitymig.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
