SDK reference
Go deeper into methods, templates, and result states.
Open page
AdPlayDeveloper Docs
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.
Assets -> Import Package -> Custom PackageWindows -> Ad Play -> App KeyWindow -> Ad Play -> Spawn PrefabAdPlay templates use RTLTMPro.RTLTextMeshPro for right-to-left title, description, and button text. Install RTLTMPro before importing or compiling the SDK.
https://github.com/hk1ll3r/RTLTMPro.git?path=/UPMPackage
"com.nosuchstudio.rtltmpro": "https://github.com/hk1ll3r/RTLTMPro.git?path=/UPMPackage"
به این صورت میتوانیم تبلیغات را صدا بزنیم.
private void OnEnable()
{
AdPlayManager.OnGetAdsComplete += HandleAdPlayInitialized;
}
private void OnDisable()
{
AdPlayManager.OnGetAdsComplete -= HandleAdPlayInitialized;
}
private void HandleAdPlayInitialized()
{
Debug.Log("AdPlay SDK initialized successfully.");
}
[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);
}
[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);
}
[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");
}
}
public async void ShowInterstitialSound()
{
var result = await AdPlayManager.GetInterstitialSound();
if (!result.IsSuccess)
{
Debug.Log("No interstitial sound");
}
}