Splash
Full-entry ad for launch, loading, or pre-menu moments.
var result = await AdPlayManager.GetSplash(template, Adplay.Model.CreativeShowType.Permanent);
AdPlayDeveloper Docs
AdPlayManager is responsible for SDK initialization, server requests, image downloading, active ad caching, display, and engagement reporting.
Visual ad methods receive an AdPlayTemplate, while interstitial sound plays without a template. All methods return AdRequestInfo.
در SDK 2.5 حالت CreativeShowType.Permanent یا WeightBased را انتخاب کنید. بنر به BannerPlaceType نیز نیاز دارد (در این نمونه MainMenuSlot1). کالبک دکمه پاپآپ، relatedAdId را به GetPopUp میدهد. canvas و templatePrefab را در Inspector تنظیم کنید.
Full-entry ad for launch, loading, or pre-menu moments.
var result = await AdPlayManager.GetSplash(template, Adplay.Model.CreativeShowType.Permanent);Small persistent placement for menus, stores, or calm screens.
var result = await AdPlayManager.GetBanner(template, Adplay.Model.CreativeShowType.Permanent, Adplay.Model.BannerPlaceType.MainMenuSlot1);A larger template-driven ad, useful after transitions or on menu screens.
var result = await AdPlayManager.GetPopUp(template, relatedAdId);Shows only a button first. The popup opens after the player clicks.
var result = await AdPlayManager.GetPopUpButton(buttonTemplate, Adplay.Model.CreativeShowType.Permanent, OnClick);Plays an interstitial audio ad without creating a UI template.
var result = await AdPlayManager.GetInterstitialSound(Adplay.Model.CreativeShowType.Permanent);| Method | Use for | Template requirements |
|---|---|---|
| AdPlayManager.GetSplash(template, Adplay.Model.CreativeShowType.Permanent) | Full-screen or launch-time splash ad | Image |
| AdPlayManager.GetBanner(template, Adplay.Model.CreativeShowType.Permanent, Adplay.Model.BannerPlaceType.MainMenuSlot1) | Banner placement in a Canvas | Image |
| AdPlayManager.GetPopUp(template, relatedAdId) | Clickable popup ad with optional title, description, and button text | Image, Button, RectTransform |
| AdPlayManager.GetPopUpButton(template, creativeShowType, onClick) | Button-style entry point that can open a PopUp when clicked | Image, Button |
| AdPlayManager.GetInterstitialSound(Adplay.Model.CreativeShowType.Permanent) | Interstitial audio ad without UI template setup | None |
Templates are Unity UI prefabs that AdPlay fills with ad content.
| Field | Type | Use |
|---|---|---|
| rectTransform | RectTransform | Controls ad size and layout. |
| image | Image | Displays the ad creative image. |
| clickButton | Button | Handles ad click interaction. |
| titleText | RTLTextMeshPro | Displays the ad title. |
| descriptionText | RTLTextMeshPro | Displays the ad body text. |
| clickButtonText | RTLTextMeshPro | Displays the call-to-action label. |
Canvas
└── AdContainer
└── AdPlayTemplate
├── AdImage
├── TitleText
├── DescriptionText
└── ClickButton
└── ButtonTextEvery ad method returns AdRequestInfo so developers can handle empty inventory and integration mistakes.
bool IsSuccess;
AdRequestResultState State;
string ErrorMessage;This sample shows how to wait for ads to finish loading, enable the test UI, instantiate templates, and call each supported ad method.
using Adplay.Behaviours;
using Adplay.View;
using UnityEngine;
using UnityEngine.UI;
namespace Adplay.Test
{
public class SampleTest : MonoBehaviour
{
[SerializeField] private Transform canvas;
[SerializeField] private AdPlayTemplate templatePrefab;
[SerializeField] private GameObject infoGameObject, sampleTestGameObject;
[SerializeField] private Transform buttonParent;
[Space]
[SerializeField] private GameObject runtimeButtonsRoot;
[SerializeField] private Button splashBtn, bannerBtn, popupButtonBtn, voiceBtn;
private void OnEnable()
{
AdPlayManager.OnGetAdsComplete += OnGetAdsComplete;
InitializeRuntimeButtons();
}
private void OnDisable()
{
AdPlayManager.OnGetAdsComplete -= OnGetAdsComplete;
}
private void OnGetAdsComplete()
{
infoGameObject.SetActive(false);
sampleTestGameObject.SetActive(true);
runtimeButtonsRoot.SetActive(true);
}
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");
}
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");
}
}
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");
}
}
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");
}
}
private void InitializeRuntimeButtons()
{
splashBtn.onClick.AddListener(ShowSplashPermanent);
bannerBtn.onClick.AddListener(ShowPermanantBanner);
popupButtonBtn.onClick.AddListener(ShowPopUpButtonPermanent);
voiceBtn.onClick.AddListener(ShowPermanentInterstitialSound);
}
}
}
These are the methods developers should use directly.
await AdPlayManager.GetSplash(AdPlayTemplate template, CreativeShowType creativeShowType)
await AdPlayManager.GetBanner(AdPlayTemplate template, CreativeShowType creativeShowType, BannerPlaceType bannerPlaceType)
await AdPlayManager.GetPopUp(AdPlayTemplate template, int relatedAdId)
await AdPlayManager.GetPopUpButton(AdPlayTemplate template, CreativeShowType creativeShowType, Action<int> onClick)
await AdPlayManager.GetInterstitialSound(CreativeShowType creativeShowType)