TowerBuildGame/Tower Build Game/Assets/Scripts/Ads.cs

38 lines
801 B
C#
Raw Normal View History

2025-05-12 05:50:37 +03:00
/*
* Author: Nikolay Dvurechensky
* Site: https://www.dvurechensky.pro/
* Gmail: dvurechenskysoft@gmail.com
* Last Updated: 12 мая 2025 05:48:46
* Version: 1.0.4
*/
2024-10-05 09:11:13 +03:00
using UnityEngine;
using UnityEngine.Advertisements;
using System.Collections;
public class Ads : MonoBehaviour
{
private string gameID = "4689491", type = "video";
private bool testMode = true;
private void Start()
{
Advertisement.Initialize(gameID, testMode);
Debug.Log(Advertisement.isInitialized);
StartCoroutine(ShowAd());
}
private IEnumerator ShowAd()
{
while (true)
{
if(Advertisement.IsReady(type))
{
Debug.Log("Ready");
}
yield return new WaitForSeconds(1f);
}
}
}