Search Unity

Frustation on Unity Ads.

Discussion in 'Scripting' started by KuaStore, Jul 30, 2015.

  1. KuaStore

    KuaStore

    Joined:
    Feb 3, 2015
    Posts:
    10
    Hello everybody! hope you all doing good.

    So recenlty I started working with ads. However, I can't really get them to work. I just want a simple BOX/IMAGE WITH COLLIDER OR 2D SPRITE when you touch it, an AD will display. That's all. however it's not working. My game is android and this is my script. Does the OnMouseDown not work with android touch? and when I tried it. It does work, however it's very buggy (sometimes it works, sometimes not and then it stops working) What I have here is a simple box collider and this script. Thanks guys!

    Code (CSharp):
    1.      using UnityEngine;
    2.      using System.Collections;
    3.      using UnityEngine.Advertisements;
    4.    
    5.    
    6.      public class Touch2 : MonoBehaviour {
    7.        
    8.          // Use this for initialization
    9.          void Start () {
    10.            
    11.          }
    12.        
    13.          // Update is called once per frame
    14.              void OnMouseDown() {
    15.                  //now your gameObject was clicked!
    16.                  Advertisement.Initialize ("57898");
    17.                  if(Advertisement.isReady()){ Advertisement.Show(); }
    18.              }
    19.          }    
    I also tried other codes I made. Sometimes it works, sometimes not and getting really frustrated here, any help would be nice :)
     
  2. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    where are you initialising the ad?
     
  3. KuaStore

    KuaStore

    Joined:
    Feb 3, 2015
    Posts:
    10
    On the box collider of a gameobject which is just a box with collider.

    I am sure it's something like that, but it's not working. Doesn't void OnMouseDown() { work on mobile device android too?
     
  4. KuaStore

    KuaStore

    Joined:
    Feb 3, 2015
    Posts:
    10
    Is there by any chance a limit on how many times you can click on an ad? I mean, I just tweaked it a bit and for the first time, it working but however about 3 clicks and watching the ads, then it won't work. Even re-installing it won't work. Just a blank click.
     
  5. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,913
    Initialize should only be called in Awake/Start, not every time.

    Put your game into test mode at Monetization Settings > Advanced on the website.

    There's some type of limit to live ads per day per user, but no limit to test ads.
     
  6. KuaStore

    KuaStore

    Joined:
    Feb 3, 2015
    Posts:
    10
    Thanks Stardog, I changed the ads to test mode and it asked me for the "Advertising ID of the device" and I left that blank. I tested it now on my mobile, unfortunately it's not working. Same problem nothing is happening. (Also tried them with all off and all on, still nothing.)

    PS: The thing is, testing it on unity works fine. The ads says there working on the first click. However, on mobile they are not showing up. They only worked once for about 1-3 times after I put the game over 10 times into my mobile for testing after that won't work again.
     
    Last edited: Aug 1, 2015
  7. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,913
    Use the "Force all" setting.