AdPlayDeveloper Docs
Integration path

Quick start

This page gives developers the minimum steps needed to install dependencies, import AdPlaySDK.unitypackage, configure the App Key, wait for initialization, and request Splash, Banner, PopUp, PopUpButton, and interstitial sound ads in Unity.

  1. Install requirementsUnity و RTLTMPro رو اماده کنید
  2. ایمپورت پکیج SDKAssets -> Import Package -> Custom Package
    دانلود پکیج
  3. Set the app keyWindows -> Ad Play -> App Key
  4. Spawn the manager prefabWindow -> Ad Play -> Spawn Prefab
  5. Wait for initializationUse OnGetAdsComplete before enabling ad buttons or requesting ads.
  6. Show an adInstantiate an AdPlayTemplate under a Canvas and pass it to a public ad method.
Dependencies

Install RTLTMPro

AdPlay templates use RTLTMPro.RTLTextMeshPro for right-to-left title, description, and button text. Install RTLTMPro before importing or compiling the SDK.

Package Manager git URL
https://github.com/hk1ll3r/RTLTMPro.git?path=/UPMPackage
manifest.json
"com.nosuchstudio.rtltmpro": "https://github.com/hk1ll3r/RTLTMPro.git?path=/UPMPackage"

فراخوانی تبلیغات

به این صورت می‌توانیم تبلیغات را صدا بزنیم.

WaitForInitialization.cs
private void OnEnable()
{
    AdPlayManager.OnGetAdsComplete += HandleAdPlayInitialized;
}

private void OnDisable()
{
    AdPlayManager.OnGetAdsComplete -= HandleAdPlayInitialized;
}

private void HandleAdPlayInitialized()
{
    Debug.Log("AdPlay SDK initialized successfully.");
}
Show banner
[SerializeField] private Transform canvas;
[SerializeField] private AdPlayTemplate templatePrefab;

public async void ShowBanner()
{
    var template = Instantiate(templatePrefab, canvas);
    var result = await AdPlayManager.GetBanner(template);

    if (!result.IsSuccess)
        Debug.Log(result.ErrorMessage);
}
Show splash
[SerializeField] private Transform canvas;
[SerializeField] private AdPlayTemplate templatePrefab;

public async void ShowSplash()
{
    var template = Instantiate(templatePrefab, canvas);
    var result = await AdPlayManager.GetSplash(template);

    if (!result.IsSuccess)
        Debug.Log(result.ErrorMessage);
}
Show PopUp
[SerializeField] private Transform canvas;
[SerializeField] private AdPlayTemplate templatePrefab;

public async void ShowPopUpButton()
{
    var buttonTemplate = Instantiate(templatePrefab, canvas);

    var result = await AdPlayManager.GetPopUpButton(
        buttonTemplate,
        async () =>
        {
            var popupTemplate = Instantiate(templatePrefab, canvas);
            var popupResult = await AdPlayManager.GetPopUp(popupTemplate);

            if (!popupResult.IsSuccess)
                Debug.Log(popupResult.ErrorMessage);
        });

    if (!result.IsSuccess)
        Debug.Log(result.ErrorMessage);
}

public async void ShowInterstitialSound()
{
    var result = await AdPlayManager.GetInterstitialSound();

    if (!result.IsSuccess)
    {
        Debug.Log("No interstitial sound");
    }
}
InterstitialSound
public async void ShowInterstitialSound()
{
    var result = await AdPlayManager.GetInterstitialSound();

    if (!result.IsSuccess)
    {
        Debug.Log("No interstitial sound");
    }
}
API

SDK reference

Go deeper into methods, templates, and result states.

Open page
FLOW

Workflow

See the full ad-serving flow from company dashboard to Unity UI.

Open page
SDK

SDK overview

Review SDK responsibilities, supported formats, and package structure.

Open page