- Home /
Question by
twotostudio · Oct 07, 2020 at 01:18 PM ·
scene-loadingadvertisingunityads
Advertising problem in scene transitions
public class move : MonoBehaviour, IUnityAdsListener
{
string placement = "rewardedVideo";
void Start()
{
Advertisement.AddListener(this);
Advertisement.Initialize("3850751", true);
}
public void ShowAd(string p)
{
if (Advertisement.IsReady(placement))
{
Advertisement.Show(p);
}
}
public void OnUnityAdsDidFinish(string placement, ShowResult showResult)
{
if (showResult == ShowResult.Finished)
{
Debug.Log(message: "Give reward!");
}
else if (showResult == ShowResult.Failed)
{
Debug.Log(message: "Oh No!");
}
}
public void OnUnityAdsDidStart(string placement)
{
Debug.Log(message: "The ad started");
}
public void OnUnityAdsReady(string placement)
{
Debug.Log(message: "The ad is ready");
}
public void OnUnityAdsDidError(string message)
{
Debug.Log(message: "The ad is trouble");
}
//OTHER SCENE
public class rewardbox : MonoBehaviour, IUnityAdsListener
{
string placementID = "rewardedVideo";
void Start()
{
Advertisement.AddListener(this);
Advertisement.Initialize("3850751", true);
}
public void OnUnityAdsDidFinish(string placementId, ShowResult showResult)
{
if (showResult == ShowResult.Finished)
{
StartCoroutine(SimulateEditorRequestRewardAd()); //running a coroutine for the daily reward system.
Debug.Log(message: "Give reward!");
}
else if (showResult == ShowResult.Failed)
{
Debug.Log(message: "Oh No!");
}
}
public void OnUnityAdsDidStart(string placementId)
{
Debug.Log(message: "The ad started");
}
public void OnUnityAdsReady(string placementId)
{
Debug.Log(message: "The ad is ready");
}
public void OnUnityAdsDidError(string message)
{
Debug.Log(message: "The ad is trouble");
}
public void StartButtonu()
{
Advertisement.RemoveListener(this);
SceneManager.LoadScene("SampleScene");
}
}
I have a main menu and game scenes. These two scenes have different advertising awards. And I'm testing them. There is a problem with commercials during scene transitions. Ad does not reward when first viewed. When I open it for the second time it gives. And when the scene changes, the script referenced in "This Behavior (Game Object") is missing on the console! "I need to add something else about the commercials in the transitions. But I don't know what to do.
Comment
Your answer
Follow this Question
Related Questions
Unity Ads Advertising Identifier (iOS) 1 Answer
Unity Ads eCPM fluctuating? 0 Answers
Is it Possible to Simulate UnityAds Load Failure? 1 Answer
User-initiated ads VS click fraud 1 Answer
OnUnityAdsShowComplete not working 2 Answers