Native Ads Unity not clickable

45 views
Skip to first unread message

Alan Wong

unread,
Jul 2, 2024, 1:49:34 PMJul 2
to Google Mobile Ads SDK Developers
I am trying to implement native ads into my Unity game.  The ads icon is blurred at the beginning and I did some tricks to make it work.  However, I found that the ads is not clickable.  I tried many different ways but still had no luck.  Please help.

I am sure that the box colliders are big enough to click.  Also, I placed the objects inside a canvas with a render mode "Screen Space - Camera" and assigned the main camera to it.  I also disabled the raycast of all the objects to ensure they would not block the clicks.  Please let me know what else I may missed in the setup.

Below is the code I use for setting up the ads.

//Setup Icons - with a fix of blurry icons by creating mipmap for them
var adsIconTexture = loadingScreenAds.nativeAd.GetIconTexture();
                            var mipTexture = new Texture2D(adsIconTexture.width, adsIconTexture.height, TextureFormat.RGB24, false);
                            mipTexture.SetPixels(adsIconTexture.GetPixels());
                            mipTexture.filterMode = FilterMode.Trilinear;
                            mipTexture.Apply();
                            AdsImage.texture = mipTexture;

                            var adsChioceTexture =  loadingScreenAds .nativeAd.GetAdChoicesLogoTexture();
                            var mipTexture2 = new Texture2D(adsChioceTexture.width, adsChioceTexture.height, TextureFormat.RGBA32, false);
                            mipTexture2.SetPixels(adsChioceTexture.GetPixels());
                            mipTexture2.filterMode = FilterMode.Trilinear;
                            mipTexture2.Apply();
                            AdsChioce.texture = mipTexture2;
//Setup Text
AdsTitle.text =  loadingScreenAds.nativeAd.GetHeadlineText();
AdsButtonText.text =  loadingScreenAds.nativeAd.GetCallToActionText();
AdsDescription.text =  loadingScreenAds.nativeAd.GetBodyText();

//Register objects
loadingScreenAds.nativeAd.RegisterIconImageGameObject(AdsImage.gameObject);
loadingScreenAds.nativeAd.RegisterHeadlineTextGameObject(AdsTitle.gameObject);
loadingScreenAds.nativeAd.RegisterCallToActionGameObject(AdsButtonText.gameObject);
loadingScreenAds.nativeAd.RegisterBodyTextGameObject(AdsDescription.gameObject);
loadingScreenAds.nativeAd.RegisterAdChoicesLogoGameObject(AdsChioce.gameObject);

Thank you.Colliders.png

Mobile Ads SDK Forum Advisor

unread,
Jul 3, 2024, 2:41:27 AMJul 3
to won...@gmail.com, google-adm...@googlegroups.com

Hi,

Thank you for contacting the Mobile Ads SDK Support team.

Could you confirm whether the mentioned issue is reproducible in our Google Sample Project as well? 

Please share the app ID, ad unit ID and SDK version with us so that we can conduct a thorough investigation via reply to author option.

This message is in relation to case "ref:!00D1U01174p.!5004Q02tJXu5:ref" (ADR-00244930)

Thanks,
 
Google Logo Mobile Ads SDK Team

 

Alan Wong

unread,
Jul 8, 2024, 5:12:50 AMJul 8
to Google Mobile Ads SDK Developers
I finally found out the problem.  There should be some of the game objects in my scene that make the click not work.  I am really surprised as they are not even UI elements and have no way to block the click detection.   I am not going to find out which and how those objects stop the ads click event.  What I did was just make them inactive when the ads appeared and activate them again afterward.

I never thought about the non-UI elements that could affect the click detection of the ads (they are all empty objects with scripts or 3D objects in the scene).  My feeling is that the SDK is very developer-unfriendly.  I almost changed the UI layer of the whole scene in order to place the ad in a camera space canvas.  I also spent so much time making the blurry image "seeable" (need to handle mipmap), finding a hacky way to make the clicks work.  I need to disable and test the objects one by one to check which object affected the click detection, and I need to make a build and deploy it to my Android phone every time I test it.

Anyway, at least it's working now.  Thank you for your help.

Şahin Kanbur

unread,
Jul 9, 2024, 9:33:41 AMJul 9
to Alan Wong, Google Mobile Ads SDK Developers

8 Tem 2024 Pzt 12:12 tarihinde Alan Wong <won...@gmail.com> şunu yazdı:
--

---
You received this message because you are subscribed to the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-admob-ads-sdk/434f84ef-21b7-4016-9549-0eb99b595ab6n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages