> Blockquote
Hi guys, my unity ads are not working and i also like not get a exact reasen like why? im using unity monetization version 3.7.5 (newest) My code should be working cause im using it also on my other project and the ads work there. but idk why it doesnt work i only get the Debugwarning. my testmode is enabled and i also have a testmode bool. This is my code that im using for the ads.
Blockquote
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Advertisements;
public class UnityMonetization : MonoBehaviour, IUnityAdsListener
{
string GooglePlay_ID = "XXX";
bool TestMode = true;
string myPlacementId = "rewardedVideo";
// Start is called before the first frame update
void Start()
{
Advertisement.AddListener(this);
Advertisement.Initialize(GooglePlay_ID, TestMode);
}
public void DisplayInterstittialAD()
{
Advertisement.Show();
}
public void DisplayVideoAD()
{
Advertisement.Show(myPlacementId);
}
// Implement IUnityAdsListener interface methods:
public void OnUnityAdsDidFinish(string placementId, ShowResult showResult)
{
// Define conditional logic for each ad completion status:
if (showResult == ShowResult.Finished)
{
// Reward the user for watching the ad to completion.
Debug.LogWarning("You Get a Reward");
}
else if (showResult == ShowResult.Skipped)
{
// Do not reward the user for skipping the ad.
Debug.LogWarning("You DONT Get a Reward");
}
else if (showResult == ShowResult.Failed)
{
Debug.LogWarning("The ad did not finish due to an error.");
}
}
public void OnUnityAdsReady(string placementId)
{
// If the ready Placement is rewarded, show the ad:
if (placementId == myPlacementId)
{
}
}
public void OnUnityAdsDidError(string message)
{
// Log the error.
}
public void OnUnityAdsDidStart(string placementId)
{
// Optional actions to take when the end-users triggers an ad.
}
// When the object that subscribes to ad events is destroyed, remove the listener:
public void OnDestroy()
{
Advertisement.RemoveListener(this);
}
}
this is the code im using btw i deleted the gameid cause i dont wanna show it. I have found no solution and i have no idea why. please answer me
↧