Show ads by destroying my player

My problem is pretty crazy, when I see 2 or more advertisements my player simply disappears from the screen.

I already delete all the destroyers related to the item that calls my ads and even then my player disappears, I am not calling anything related to ads in any script of my player, only a script “gerenciador” that adds the prize, the ads is linked in a I do not know if this object is also destroyed because I do not know how to debug on the mobile, I even used the remote unity 5 but on the computer everything works without problem, ie the player is only destroyed when it actually calls the advertisement, which Does not happen on the PC.

Here are my codes:

  • NEXT SCRIPT IN ADD TO MY ChamaADS OBJECT

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Advertisements;

public class ADScript : MonoBehaviour {
private string qual;
private Gerenciador gerenciador;
public int valormoeda;
public int valordiamante;
private int quantidadepropag;

void Start () {

gerenciador = FindObjectOfType (typeof(Gerenciador)) as Gerenciador;
quantidadepropag= PlayerPrefs.GetInt (“quantidadepropag”);

}

public void chamavideo(string zone,string qualitem){

qual = qualitem;

if (quantidadepropag <= 0) {

ShowAd (zone);

} else {
if (qual == “caixa”) {
gerenciador.mostrarmensagem (“Ganhou Caixa”);
Time.timeScale = 1;
gerenciador.addcaixas (1);
}
if (qual == “moeda”) {
gerenciador.mostrarmensagem (“Ganhou moedas”);
Time.timeScale = 1;
gerenciador.addmoedas (valormoeda);
}
if (qual == “diamante”) {
gerenciador.mostrarmensagem (“Ganhou diamantes”);
Time.timeScale = 1;
gerenciador.adddiamantes (valordiamante);
}
}

}

public void ShowAd(string zone = “”)
{
#if UNITY_EDITOR
StartCoroutine(WaitForAd ());
#endif

if (string.Equals (zone, “”))
zone = null;

ShowOptions options = new ShowOptions ();
options.resultCallback = AdCallbackhandler;

if (Advertisement.IsReady (zone))
Advertisement.Show (zone, options);
else
StartCoroutine (“tentadenovo”);
Advertisement.Show (zone, options);

}

void AdCallbackhandler (ShowResult result)
{
switch(result)
{
case ShowResult.Finished:

if (qual == “caixa”) {
gerenciador.mostrarmensagem (“Ganhou Caixa”);
Time.timeScale = 1;
gerenciador.addcaixas (1);
}
if (qual == “moeda”) {
gerenciador.mostrarmensagem (“Ganhou moedas”);
Time.timeScale = 1;
gerenciador.addmoedas (valormoeda);
}
if (qual == “diamante”) {
gerenciador.mostrarmensagem (“Ganhou diamantes”);
Time.timeScale = 1;
gerenciador.adddiamantes (valordiamante);
}

break;
case ShowResult.Skipped:
gerenciador.mostrarmensagem (“Pulou o Video”);
Time.timeScale = 1;
break;
case ShowResult.Failed:
gerenciador.mostrarmensagem (“Conexão falhou”);
if (qual == “caixa”) {
Time.timeScale = 1;
gerenciador.addcaixas (1);
}
if (qual == “moeda”) {
Time.timeScale = 1;
gerenciador.addmoedas (valormoeda);
}
if (qual == “diamante”) {
Time.timeScale = 1;
gerenciador.adddiamantes (valordiamante);
}
break;
}

}

IEnumerator WaitForAd()
{
float currentTimeScale = Time.timeScale;
Time.timeScale = 0f;
yield return null;
while (Advertisement.isShowing)
yield return null;
Time.timeScale = currentTimeScale;
}

IEnumerator tentadenovo (){
Advertisement.Initialize (“xxxxxxxx”,true);
gerenciador.mostrarmensagem (“Tentando Conexão”);
yield return new WaitForSeconds (3);

}

}

  • NEXT SCRIPT IN ADD TO MY ITEM OBJECT INSTANTIATE
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;

public class PegaDiamante : MonoBehaviour {

private ADScript adsvai;
private GameObject item;

void Start () {

item = GameObject.FindGameObjectWithTag (“diamante”);
adsvai = FindObjectOfType (typeof(ADScript)) as ADScript;
//Destroy (gameObject,30f);

}

void OnCollisionEnter2D(Collision2D colisor){

if (colisor.gameObject.tag == “Player”) {

adsvai.chamavideo (“video”, “diamante”);
//Destroy (gameObject);

}

}

}

  • MY Advertisement.Initialize (“xxxxxx”,true); IS ATTACHED TO A SCRIPT FROM MY MAIN CAMERA

Thanks and sorry my english, using google translation.

I discovered the problem, my player for some reason was not pausing the movements and was forcing the collider until I could get through, I solved by calling my game pause panel every time I see the advertisement.

Thanks…