Search Unity

Unity Ads show on 19th death in Editor , but not on Android device

Discussion in 'Unity Ads & User Acquisition' started by Vasov97, Mar 18, 2017.

  1. Vasov97

    Vasov97

    Joined:
    Aug 4, 2016
    Posts:
    28
    using UnityEngine;
    using UnityEngine.SceneManagement;
    using UnityEngine.UI;
    using UnityEngine.Advertisements;

    public class BallScript : MonoBehaviour
    {

    public void ShowAd()
    {
    if (Advertisement.IsReady())
    {
    Advertisement.Show();
    }
    }


    public Vector2 startForce;

    static int times = 0;

    public Text goverText;

    public Vector3[] positions;

    public Rigidbody2D rb;

    void Start()
    {
    int randomNumber = Random.Range(0, positions.Length);
    transform.position = positions[randomNumber];
    times = PlayerPrefs.GetInt("Played:", times);
    rb.AddForce(startForce, ForceMode2D.Impulse);


    }

    void Update()
    {

    PlayerPrefs.SetInt("Played:", times);
    goverText.text = "Played:" + times.ToString();


    }

    void OnCollisionEnter2D(Collision2D other)
    {
    if (other.gameObject.name == "wall_bottom")
    {

    times++;

    if (times==19)
    {
    ShowAd();
    }

    SceneManager.LoadScene("wfvv");


    }

    }

    }
     
  2. rasmus-unity

    rasmus-unity

    Moderator

    Joined:
    Aug 15, 2014
    Posts:
    1,312
    If it works in editor, it should also work on device. Please check device log (using "adb logcat -v time UnityAds:V *:S") to see if it contains relevant information, e.g. if you get any campaigns. Look for calls to "adserver.unityads.unity3d.com"

    /Rasmus
     
  3. Vasov97

    Vasov97

    Joined:
    Aug 4, 2016
    Posts:
    28
    "adb logcat -v time UnityAds:V *:S" where should I put this line ?
     
  4. rasmus-unity

    rasmus-unity

    Moderator

    Joined:
    Aug 15, 2014
    Posts:
    1,312
    Sorry, command line. adb is the Android "debugger" command. Above command will show messages from Unity Ads SDK only
     
  5. Vasov97

    Vasov97

    Joined:
    Aug 4, 2016
    Posts:
    28
    Still nothing...
    When I'm installing apk file to my phone it demands internet access , but in game no ads :((
     
  6. Vasov97

    Vasov97

    Joined:
    Aug 4, 2016
    Posts:
    28
    Now is working , but seems that video won't be shown everytime when I call ads
     
  7. rasmus-unity

    rasmus-unity

    Moderator

    Joined:
    Aug 15, 2014
    Posts:
    1,312
    Ok, but as said, the device log should contain information which can help you to figure out why you're not getting ads everytime.

    /Rasmus
     
  8. Vasov97

    Vasov97

    Joined:
    Aug 4, 2016
    Posts:
    28
    How to do that ?
     
  9. Vasov97

    Vasov97

    Joined:
    Aug 4, 2016
    Posts:
    28
    I got this
     

    Attached Files:

  10. rasmus-unity

    rasmus-unity

    Moderator

    Joined:
    Aug 15, 2014
    Posts:
    1,312
  11. Vasov97

    Vasov97

    Joined:
    Aug 4, 2016
    Posts:
    28