> For the complete documentation index, see [llms.txt](https://docs.airflux.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.airflux.ai/airflux-onboarding/airflux-integration-unity/2.-install-the-airflux-sdk.md).

# 2. Install the Airflux SDK

## 1. SDK Installation

Follow the steps below to add the Airbridge SDK package file to your project.

{% tabs %}
{% tab title="Unity" %}

1. Download the latest version of the[ Airflux Unity SDK package file](https://sdk-download.airflux.ai/unity/index.html?latest).
2. Import the package file by selecting the menu option **\[Assets]>\[Import Package]>\[Custom Package]**.
3. When the import is complete, the **\[Airflux]** tab will appear in the top menu bar of the Unity Editor.
   {% endtab %}
   {% endtabs %}

***

## 2. SDK Initialization

The Airflux Unity SDK is designed to initialize automatically upon app launch once the package is imported and configured. Unlike Native SDKs, it is not necessary to write a separate initialization code (e.g., `Airflux.Initialize()`) in your scripts.

**Configure SDK Settings**

After importing the package, configure the SDK options through the Unity Editor menu.

1. In the Unity top menu bar, go to **\[Airflux] > \[Settings]**.
2. Enter the required information and adjust options in the inspector window.

<table><thead><tr><th width="125.76171875">SDK Option</th><th width="118.22265625">Data Type</th><th width="295.0703125">Description</th><th>Required</th></tr></thead><tbody><tr><td>App Name</td><td><code>string</code></td><td>Input the App Name from the Airbridge dashboard.</td><td><strong>Required</strong></td></tr><tr><td>App Token</td><td><code>string</code></td><td>Input the App Token from the Airbridge dashboard.</td><td><strong>Required</strong></td></tr><tr><td>SDK Enabled</td><td><code>boolean</code></td><td><p>Set whether to enable the SDK upon initialization.</p><ul><li>true: The SDK is initialized in active mode.</li><li>false: The SDK is initialized in inactive mode and is enabled upon calling the <code>Airflux.EnableSDK()</code> function.</li></ul></td><td>Optional</td></tr><tr><td>Auto Start Tracking Enabled</td><td><code>boolean</code></td><td><p>Set whether to collect events automatically upon SDK initialization.</p><ul><li>true: Event collection starts automatically upon initialization.</li><li>false: Event collection starts upon calling the <code>Airflux.StartTracking()</code> function.</li></ul></td><td>Optional</td></tr><tr><td>Log Level</td><td><code>AirfluxLogLevel</code></td><td>Set the log level for the Airflux SDK. Choose from <code>debug</code>, <code>info</code>, <code>warning</code>, <code>error</code>, <code>fault</code> .</td><td>Optional</td></tr><tr><td>Session Timeout</td><td><code>double</code></td><td>The default value is 300 seconds. Modify if needed.</td><td>Optional</td></tr><tr><td>Allow Every Country Enabled</td><td><code>boolean</code></td><td>When set to true, all countries are allowed to follow Airflux's optimization policies. To use a specific list of countries, set it to false and provide a list using <code>setCountryAllowlist()</code>.</td><td>Optional</td></tr><tr><td>Country Allowlist</td><td><code>List&#x3C;String></code></td><td>Set the countries where calling the Airflux's inference API should be allowed. Use country codes following the ISO 3166-1 alpha-2 format (e.g., US, KR). You can set multiple countries using the Country Allowlist. Airflux identifies a country based on the value tied to the device.</td><td>Optional</td></tr></tbody></table>

***

## 3. Verification

#### **Unity Log check**

To view detailed log information for your app, use the Unity Log tool.

{% hint style="warning" %}
You can set the log output level using the `setLogLevel` function. \
Setting it to `AirfluxLogLevel.DEBUG` allows you to see all Airflux logs.
{% endhint %}

***

## 4. Frequently Asked Questions

{% hint style="info" %}
Opt-in policy compliance

If player consent is required to send in-game data, implement the necessary setup by following the FAQ section below.&#x20;

[How can I set up the Airflux SDK to comply with the opt-in policy?](https://docs.airflux.ai/airflux-onboarding/airflux-integration/2.-install-the-airflux-sdk#how-can-i-set-up-the-airflux-sdk-to-comply-with-the-opt-in-policy)
{% endhint %}

<details>

<summary>How can I set up the Airflux SDK to comply with the opt-in policy?</summary>

The opt-in policy requires user consent before collecting and using player data. To adhere to this policy, implement the following methods.

1. **SDK opt-in setup**

Upon initialization of the Airflux SDK, set the initialization option `SetAutoStartTrackingEnabled()`to `false` and call the `StartTracking()` function at the point where you have received user consent for data tracking. The Airflux SDK will collect data after the `startTracking()` function is called.

{% hint style="warning" %}
**Attention**

Although event data is not tracked before `StartTracking()` is triggered and after `StopTracking()` is triggered, player attribute data is aggregated and anonymized for transmission upon calling the Inference API.
{% endhint %}

```csharp
// After player provided consent to data tracking
Airflux.StartTracking()

// If player withdraws consent to data tracking
Airflux.StopTracking()
```

2. **Initializing the Airflux SDK in inactive mode**

{% hint style="warning" %}
**Attention**

If the SDK is not enabled immediately after the SDK initialization, the Install and Open events may not be collected.
{% endhint %}

Set the initialization option `SetSDKEnabled()` to `false` to initialize the SDK with all functions disabled until user consent for data tracking is obtained. Through this method, you can adhere to privacy policies to the highest level. Note that when the SDK is set in inactive mode, all features are disabled and no events and player attribute data is sent to Airflux.

</details>

<details>

<summary>How can I configure the Airflux SDK to call the Inference API only in specific countries</summary>

Set the initialization opeion `SetAllowEveryCountryEnabled()` to false and add the countries you want to allow to the "Country Allowlist". Country codes should follow the ISO 3166-1 alpha-2 format (e.g., "US", "KR"), and multiple countries can be specified by separating codes with commas. Country codes are not case-sensitive.

</details>

<details>

<summary>Can I use other mediation platforms, such as MAX and AdMob, with Airflux?</summary>

Yes, Airflux is designed to work alongside existing mediation platforms.

</details>

<details>

<summary>How does Airflux determine a user’s country?</summary>

Airflux distinguishes a country based on the value tied to the deivce.

</details>

<details>

<summary>Does Airflux collect the ADID (Advertising ID)?</summary>

No. The Airflux SDK operates without collecting or requiring the ADID.

</details>

## 5. Troubleshooting

<details>

<summary>[Android] A coroutine dependency error occurs during the build process. </summary>

#### Issue

A coroutine dependency error occurs during the build process with the following message.

```
java.lang.NoClassDefFoundError: kotlin/coroutines/AbstractCoroutineContextKey
    at java.base/java.lang.ClassLoader.defineClass1(Native Method)
    at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
  ...
```

#### Cause

If the kotlinx-coroutines-core library version is 1.3.5 or later, [the kotlin-stdlib library version must be at a certain level or later](https://github.com/Kotlin/kotlinx.coroutines/issues/1879).

#### Solution

Check whether the kotlin-stdlib library version is v.1.3.70 or later with the `gradlew dependencies` command. If the version is earlier than v.1.3.70, you need to update it.

</details>


---

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

```
GET https://docs.airflux.ai/airflux-onboarding/airflux-integration-unity/2.-install-the-airflux-sdk.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.
