> ## Documentation Index
> Fetch the complete documentation index at: https://beta-guide.daro.so/llms.txt
> Use this file to discover all available pages before exploring further.

# Getting Started

> Install and initialize DARO Unity SDK in your Unity project.

## Before You Begin

Prepare these items before installing DARO Unity SDK:

* iOS or Android app key from the DARO dashboard
* Platform-specific DARO key file
* Ad unit IDs for each ad format
* Android or iOS build environment

## Install SDK

Use `DaroPackageInstaller.unitypackage` for the recommended installation path.

<Steps>
  <Step title="Download Installer Package">
    Download [`DaroPackageInstaller.unitypackage`](https://github.com/delightroom/DaroUnitySDK/releases/download/sdk%2F0.4.0/DaroPackageInstaller.unitypackage) from the GitHub Release.
  </Step>

  <Step title="Import into Unity Project">
    In Unity Editor, select **Assets > Import Package > Custom Package**, then import `DaroPackageInstaller.unitypackage`.
  </Step>

  <Step title="Confirm Package Installation">
    The installer adds the OpenUPM scoped registry, EDM4U, and `so.daro.unity` dependency to `Packages/manifest.json`.

    The latest `so.daro.unity` package version is `0.4.0` and uses EDM4U `com.google.external-dependency-manager@1.2.187`.
  </Step>

  <Step title="Run Integration Manager">
    In Unity Editor, open **Assets > Daro > Integration Manager** and validate your project setup.
  </Step>
</Steps>

<Tip>
  The installer adds the OpenUPM registry to `Packages/manifest.json` and starts installing `so.daro.unity@0.4.0`.
</Tip>

## Configure Project

In Unity Editor, open **Daro > Integration Manager** and enter platform settings.

<Steps>
  <Step title="Create Settings Asset">
    In Integration Manager, select **Create Settings Asset**.
  </Step>

  <Step title="Enter iOS Settings">
    For iOS builds, enter `iOS Daro App Key`, `iOS Key File`, `AdMob App ID`, and ATT prompt text.
  </Step>

  <Step title="Enter Android Settings">
    For Android builds, enter `Android Daro App Key` and `Android Key File`.
  </Step>

  <Step title="Enable Android Build Templates">
    For Android builds, open **Edit > Project Settings > Player > Android > Publishing Settings > Build** in Unity Editor, then enable these options.

    * **Custom Main Gradle Template**
    * **Custom Gradle Properties Template**
    * **Custom Gradle Settings Template**

    Unity creates these files after the options are enabled.

    * `Assets/Plugins/Android/mainTemplate.gradle`
    * `Assets/Plugins/Android/gradleTemplate.properties`
    * `Assets/Plugins/Android/settingsTemplate.gradle`

    During the Android build, DARO Unity SDK applies the required Gradle plugins, minimum SDK setting, and ProGuard rules to the exported project.
  </Step>

  <Step title="Validate Settings">
    In Integration Manager, check validation results for the active build target.
  </Step>
</Steps>

<Warning>
  When building for Android with Unity `6000.3.17f1` or newer, add the following setting to `Assets/Plugins/Android/gradleTemplate.properties`.

  ```properties theme={null}
  android.uniquePackageNames=false
  ```

  Starting with Unity `6000.3.17f1`, AGP 9.0 enables duplicate Android library namespace checks by default. The Pangle 7.7 `pag-sdk` and `pag-sdk-ad` AARs use the same `com.bytedance` namespace, so manifest merging can fail during `processDebugMainManifest`. This issue is separate from EDM4U dependency resolution failures.
</Warning>

<Tip>
  App keys and key files are not passed to `InitializeAsync()`. Unity injects them into iOS `Info.plist` and Android `AndroidManifest.xml` or `gradle.properties` at build time.
</Tip>

## Initialize SDK

Call `DaroSdk.InitializeAsync()` when your app starts.

```csharp theme={null}
using Daro;
using UnityEngine;

public sealed class GameBootstrap : MonoBehaviour
{
    private async void Start()
    {
        DaroSdk.HasGdprConsent = true;
        DaroSdk.SetUserId("user-12345");

        await DaroSdk.InitializeAsync();
        Debug.Log("Daro SDK ready");
    }
}
```

<Tip>
  You can set privacy options and user ID before SDK initialization.
</Tip>

## Use Ad Instances

Use fullscreen ad instances in this order:

1. Complete `await DaroSdk.InitializeAsync()`.
2. Create the ad instance.
3. Register event handlers.
4. Call `Load()`.
5. After load completes, check `IsReady()` and call `Show()`.
6. Call `Dispose()` when the screen closes.

Banner ads are displayed automatically when `Load()` succeeds. Use `Show()` only to display a banner again after calling `Hide()`.

<Tip>
  SDK callbacks are delivered on Unity's main thread. Constructors and public SDK methods such as `Load()`, `Show()`, `Hide()`, and `Dispose()` must also be called from the Unity main thread.
</Tip>

<Warning>
  Call `Dispose()` explicitly when an ad instance is no longer needed. SDK 0.4.0 provides finalizer-based cleanup as a fallback, but cleanup timing is not guaranteed.
</Warning>

```csharp theme={null}
using Daro;
using UnityEngine;

public sealed class InterstitialAdHost : MonoBehaviour
{
    private const string AdUnitId = "your-ad-unit-id";
    private DaroInterstitialAd ad;

    private void OnEnable()
    {
        ad = new DaroInterstitialAd(AdUnitId);
        ad.OnAdLoaded += info => Debug.Log($"Loaded: {info.AdUnitId}");
        ad.OnAdFailedToLoad += error => Debug.LogWarning(error.Message);
        ad.Load();
    }

    public void Show()
    {
        if (ad != null && ad.IsReady())
        {
            ad.Show();
        }
    }

    private void OnDisable()
    {
        ad?.Dispose();
        ad = null;
    }
}
```
