- Home /
Frustation over unity ads To Display Ad
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!
using UnityEngine;
using System.Collections;
using UnityEngine.Advertisements;
public class Touch2 : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void OnMouseDown() {
//now your gameObject was clicked!
Advertisement.Initialize ("57898");
if(Advertisement.isReady()){ Advertisement.Show(); }
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220611233513im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Flickering Sprites 0 Answers
[2D graphical bug] Sprite Edge blends. Why this is happening? 1 Answer
Sprite after skinning editor is weird 1 Answer
Problems with sprites. 0 Answers