Ad close button doesn't work

So this is my first thread here and i’m using unity ads for the first time. The thing is: when the ads show up doesn’t matter if i click “close” or “skip” it keeps being displayed. Anyone knows why that could be happening? Thanks in advance.

Is this on a device or in Unity editor?

/Rasmus

1 Like

Both. I tested it on my phone with the ads test mode enabled to check if it would work then but it didn’t

Ok, jus tried here on iPhone and at least in my game the ad is closed when i click the close or skip button.

What do you mean by “it keeps being displayed”? That the endcard (with the install button) doesn’t close, or that the ad is restarted?

Can you also share how you are implementing ads in your game/project?

Thanks,
Rasmus

1 Like

The ad is restarted. Like, INFINITE TIMES.

i have this script and i call it as “ADS.SHOWAD()” when i want show it somewhere

public class ADS : MonoBehaviour {
public static void SHOWAD()
{
if (Advertisement.IsReady())
{
Advertisement.Show();
}
}
}

and i’m calling it in this other script like this:

void Update () {
if (isgameover == true)
{
ADS.SHOWAD();
invokepanel();
apito();
playedapito = true;
}

Maybe it could be something i’m doing wrong in the code?“invokepanel()” is the game over panel and it has a “back to menu” and a “restart” button. But it remains behind the ad cause i can’t close it.

It looks like “isgameover == true” evaluates to true always, so Update() method will be called by Unity immediately after the ad has been closed, and thereby showing a new ad again?

Perhaps introduce a “hasAdBeenShown” variable, which you can set to true when you are showing ad, to avoid your endless loop of showing ads? Just a suggestion, and there are likely different solutions in your case.

/Rasmus

2 Likes

Yes, that’s what it was hahahah just me calling the function in the wrong place. I moved it to a different function and it’s working now, solved it. Thanks a lot! I have another function that actually sets “isgameover” to true outside of void update cause is triggered by a collision. I put it there instead and is not a loop anymore.