# Monetization ( Admob + Unity IAP )

### 🔷 Setup Admob

{% hint style="info" %}
For setup Admob, you can try to check this [guide](https://developers.google.com/admob/unity/quick-start).
{% endhint %}

1. Create your Admob account follow this [link](https://support.google.com/admob/answer/2784575).

2. Register you Android app or IOS app on Admob dashboard follow this [link](https://support.google.com/admob/answer/2773509).

3. Create Ad Units for each ad type ( banner, interstitial, rewarded video ) on your Admob app.

4. In the Unity editor, select **Assets -> Google Mobile Ads -> Settings** from the menu.

5. Replace the current Ads App ID with your Ads App ID.\ <br>

   <figure><img src="/files/LzvP3Fv4YTUSxSbORGAF" alt="" width="563"><figcaption><p><em>Note: The Ads App ID on the picture just is an ID Ads test, so replace it with your Ads App ID.</em></p></figcaption></figure>

6. In the Unity editor, open main menu scene -> select Ads Manager gameobject.\ <br>

   <figure><img src="/files/iVWFAGLDup71PR7DoOVi" alt="" width="563"><figcaption><p><em>Note: The current Inter Ads ID, Reward Ads ID and Banner Ads ID are all using ID Ads Test.</em></p></figcaption></figure>

7. Replace these ID Ads test with your ID Ads type ( banner, interstitial, rewarded video ) on your Admob app.&#x20;

8. All Done For Setup Admob.

### 🔷 Setup Unity IAP

{% hint style="info" %}
For setup Unity IAP, you can try to check this [guide](https://docs.unity3d.com/Packages/com.unity.purchasing@4.12/manual/GettingStarted.html).
{% endhint %}

1. Open Services General Settings window by select menu edit -> Project Settings -> Services and link the project to Unity Services.\ <br>

   <figure><img src="/files/Rg3dI13q0VPgHx2AWBV2" alt="" width="563"><figcaption><p><em>Services General Settings Window.</em> </p></figcaption></figure>

2. Select In-App Purchasing below Services menu -> turn on In-App Purchases.\
   \
   &#x20;

   <figure><img src="/files/E4fMlDYUiU95zyKI6kir" alt="" width="563"><figcaption><p><em>In-App Purchases Window.</em></p></figcaption></figure>

3. Complete setup in In-App Purchases Window.

4. Go to your Google Play Console or Apple Store Connect and create new product at In-App Purchases section.\
   \
   \&#xNAN;*Note: You can try to check this* [*guide*](https://support.google.com/googleplay/android-developer/answer/1153481?hl=en#zippy=%2Ccreate-a-single-in-app-product) *for Google Play Console and this* [*guide*](https://developer.apple.com/help/app-store-connect/manage-in-app-purchases/create-consumable-or-non-consumable-in-app-purchases/) *for Apple Store Connect.*\
   \
   \&#xNAN;*Note: The ID product should follow like this structure <mark style="background-color:blue;">com.yourcompanyname.yougamename.itemname</mark> , the example in this template <mark style="background-color:blue;">com.blackknight.2dracinggame.removeads</mark> , this ID product will be used for remove ads item.*\
   *And <mark style="background-color:blue;">com.blackknight.2dracinggame.unlockallcars</mark> will be used for unlock cars item.*<br>

5. In Unity editor, select Services menu -> In-App Purchasing -> IAP Catalog.

6. Replace the ID product on IAP Catalog same as the ID product you created on Google Play Console or Apple Store Connect.\ <br>

   <figure><img src="/files/ZjW3UK0ZYWxsJ6gwDEgn" alt=""><figcaption><p><em>IAP Catalog Window.</em></p></figcaption></figure>

7. Open main menu scene -> select button remove ads -> select the ID product you changed on IAP Catalog Window.\ <br>

   <figure><img src="/files/bXKwDRAVmTCR4dmtqC1W" alt="" width="563"><figcaption><p><em>Button Remove Ads.</em></p></figcaption></figure>

8. Select button unlock cars -> select the ID product you changed on IAP Catalog Window.\ <br>

   <figure><img src="/files/g6CyhctsSPNrNIEVTpvI" alt="" width="563"><figcaption><p><em>Button Unlock Cars.</em></p></figcaption></figure>

9. Open IAP Manager script -> Change the ID product same as The ID product on IAP Catalog Window.\ <br>

   <figure><img src="/files/aLez6UMmtLFQ8U7RxRvT" alt="" width="563"><figcaption><p><em>IAP Manager Script.</em></p></figcaption></figure>

10. All done for setup Unity IAP.


---

# Agent Instructions: 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:

```
GET https://black-knight.gitbook.io/2d-racing-multiplayer-game-template/customization/monetization-admob-+-unity-iap.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
