AdPlayDeveloper Docs
Integration path

Quick start

This page gives developers the minimum steps needed to install dependencies, import Adplay-SDK-V1.2.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 ads to loadUse 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"

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

WaitForAds.cs
private void OnEnable()
{
    AdPlayManager.OnGetAdsComplete += HandleAdsLoaded;
}

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

private void HandleAdsLoaded()
{
    Debug.Log("Ads loaded successfully.");
}
Show banner
using Adplay.Behaviours;
using Adplay.View;
using Model = Adplay.Model;
using UnityEngine;

[SerializeField] private Transform canvas;
[SerializeField] private AdPlayTemplate templatePrefab;

public async void ShowPermanantBanner()
{
    var template = Instantiate(templatePrefab, canvas);

    var result = await AdPlayManager.GetBanner(template, Model.CreativeShowType.Permanent, Model.BannerPlaceType.MainMenuSlot1);
    if (!result.IsSuccess)
    {
        Debug.Log("No banner Permanent");
    }
}

public async void ShowWeightBasedBanner()
{
    var template = Instantiate(templatePrefab, canvas);

    var result = await AdPlayManager.GetBanner(template, Model.CreativeShowType.WeightBased, Model.BannerPlaceType.MainMenuSlot1);
    if (!result.IsSuccess)
    {
        Debug.Log("No banner weight based");
    }
}

نکته: BannerPlaceType جایگاه نمایش بنر را مشخص می‌کند و دارای ۶ مدل است: MainMenuSlot1، MainMenuSlot2، MainMenuSlot3، MatchMake، GameplaySlot1 و GameplaySlot2. برای نمایش تبلیغ در هر یک از این جایگاه‌ها، باید با تیم ادپلی هماهنگ کنید.

Show splash
using Adplay.Behaviours;
using Adplay.View;
using Model = Adplay.Model;
using UnityEngine;

[SerializeField] private Transform canvas;
[SerializeField] private AdPlayTemplate templatePrefab;

public async void ShowSplashPermanent()
{
    var template = Instantiate(templatePrefab, canvas);

    var result = await AdPlayManager.GetSplash(template, Model.CreativeShowType.Permanent);
    if (!result.IsSuccess)
    {
        Debug.Log("No splash permanent");
    }
}

public async void ShowSplashWeightBased()
{
    var template = Instantiate(templatePrefab, canvas);

    var result = await AdPlayManager.GetSplash(template, Model.CreativeShowType.WeightBased);
    if (!result.IsSuccess)
    {
        Debug.Log("No splash weight based");
    }
}
Show PopUp
using Adplay.Behaviours;
using Adplay.View;
using Model = Adplay.Model;
using UnityEngine;

[SerializeField] private Transform canvas;
[SerializeField] private AdPlayTemplate templatePrefab;

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

    var result = await AdPlayManager.GetPopUpButton(buttonTemplate, Model.CreativeShowType.Permanent, async (relatedAdId) =>
    {
        var template = Instantiate(templatePrefab, canvas);
        var result = await AdPlayManager.GetPopUp(template, relatedAdId);
        if (!result.IsSuccess)
        {
            Debug.Log("No pop up permanent");
        }

    });
    if (!result.IsSuccess)
        Debug.Log("No pop up button permanent");
}

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

    var result = await AdPlayManager.GetPopUpButton(buttonTemplate, Model.CreativeShowType.WeightBased, async (relatedAdId) =>
    {
        var template = Instantiate(templatePrefab, canvas);
        var result = await AdPlayManager.GetPopUp(template, relatedAdId);
        if (!result.IsSuccess)
        {
            Debug.Log("No pop up permanent");
        }

    });
    if (!result.IsSuccess)
        Debug.Log("No pop up button permanent");
}
InterstitialSound
using Adplay.Behaviours;
using Model = Adplay.Model;
using UnityEngine;

public async void ShowPermanentInterstitialSound()
{
    var result = await AdPlayManager.GetInterstitialSound(Model.CreativeShowType.Permanent);
    if (!result.IsSuccess)
    {
        Debug.Log("No permanent interstitial sound");
    }
}

public async void ShowWeightBasedInterstitialSound()
{
    var result = await AdPlayManager.GetInterstitialSound(Model.CreativeShowType.WeightBased);
    if (!result.IsSuccess)
    {
        Debug.Log("No WeightBased 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