Hello,
I'm implementing native ads unified plugin in our Unity project.
We're using Unity 2019.1.12f1
GoogleMobileAds v4.0.0
Also downloaded NativeAds-native Unity package. I couldn't find the version there.
I would like to ask you some questions about the Native Ads Advanced (Unified) for Unity as I have some questions and some things are not clear in the docs for me. https://developers.google.com/admob/unity/native-advanced-unified?hl=en-US
I could successfully set everything up, ran an example project and applied the logic in our app.
1. What I mentioned, the plug-in sends a native test ad with
fields "Image1", "Image2", "MainText". But I couldn't find these
field names in the description docs like here: https://support.google.com/admob/answer/6240809.
Is there any other doc, where I can see the values for Unity? Will
these field names be changed when we switch to production?
2. When I applied the logic to show the images, I got this
screen. below you can see a Native Ads banner and on the top there
is a regular banner from Admob. What I don't understand here is
what Image1 (DoubleClick icon), Image2(Admob icon) and MainText
are responsible for? Like is Image1 icon is responsible for the
main icon of the project? Is image2 always an admob icon as an ads
provider? Will main text always have the title and main text
divided by "-" sign? Will the images have the same aspect ration
and resolution all the time or will it be changed?
3. How should the Native banner Unified click and impression
logic be implemented? I see that there are methods in your plug-in
that can be used. I implemented click and it redirects to a sample
ads page. WIll it be enough? How should we implement impression
logic? Should I call RecordImpression() method after 30-60 seconds
when the banner is shown? Should I call RequestBanner() again
after it to get a new one?
4. When I tried to see how the native banner unified looks like with Production keys in my build without uploading it to the google play, I got Internal Error in the logs in the method HandleNativeAdFailedToLoad(object sender, AdFailedToLoadEventArgs args). Is it a normal behavior? Do you have a specific check not to allow these production keys for dev builds? I just worry that if we upload the build into google play Prod environment, we'll have the same issue.
We need to use native ads unified as we want to have a banner
with margins, so it fits better in our UI. I could add margins
inside of your plug-ins, but you're using Proguard now) Maybe you
could add margins as an additional variable in future for regular
banners? As we're using such a banner on a gameplay screen.
5. Also what I'd like to mention that it's not so good to have ads showing in an update method.
Right now you have an update method where you set the ads to all of the possible elements:
public void Update() { if (this.nativeAdLoaded) { if (this.errorMessage1 != null) { MonoBehaviour.Destroy(this.errorMessage1); } if (this.errorMessage2 != null) { MonoBehaviour.Destroy(this.errorMessage1); } Texture2D billboardTexture1 = this.nativeAd.GetTexture2D("Image1"); Texture2D billboardTexture2 = this.nativeAd.GetTexture2D("Image2"); for (int i = 1; i <= 6; i++) { if (i % 2 == 0) { GameObject.Find("Billboard" + i.ToString()) .GetComponent<Renderer>() .material .mainTexture = billboardTexture1; } else { GameObject.Find("Billboard" + i.ToString()) .GetComponent<Renderer>() .material .mainTexture = billboardTexture2; } } GameObject textObject = new GameObject("GroundText"); GameObject ground = GameObject.Find("Ground"); textObject.transform.parent = ground.transform; textObject.transform.position = new Vector3(0, 0.1f, 0); textObject.AddComponent<TextMesh>(); TextMesh textMeshComponent = textObject.GetComponent<TextMesh>(); MeshRenderer meshRendererComponent = textObject.GetComponent<MeshRenderer>(); string adText = this.nativeAd.GetText("MainText").Replace('-', '\n'); textMeshComponent.text = adText; textMeshComponent.fontSize = 8; textMeshComponent.anchor = TextAnchor.MiddleCenter; textMeshComponent.transform.Rotate(new Vector3(90, 0, 0)); textMeshComponent.font = this.TextFont; meshRendererComponent.material = this.GroundTextMaterial; this.nativeAdLoaded = false; } }
And on Qualcomm 835 instead of 60 FPS that we had, we have 20.
Partially it happens because you call Find() Method, which is
expensive, but also it could be moved into a coroutine with
repeating the same logic at least each 0.1 second. But ideally it
would be great if you could modified the code on using events. So,
the objects would be updated only when it's needed. It would safe
a lot of resources.
Best Regards,
Denis Chernitsyn
Hi Denis,
Thank you for reaching out to us, and for giving us a very extensive write-up of your concerns. I will be addressing each of your concerns in turn:
1. What I mentioned, the plug-in sends a native test ad with fields "Image1", "Image2", "MainText". But I couldn't find these field names in the description docs like here: https://support.google.com/admob/answer/6240809. Is there any other doc, where I can see the values for Unity? Will these field names be changed when we switch to production?
2. When I applied the logic to show the images, I got this screen. below you can see a Native Ads banner and on the top there is a regular banner from Admob. What I don't understand here is what Image1 (DoubleClick icon), Image2(Admob icon) and MainText are responsible for? Like is Image1 icon is responsible for the main icon of the project? Is image2 always an admob icon as an ads provider? Will main text always have the title and main text divided by "-" sign? Will the images have the same aspect ration and resolution all the time or will it be changed?
3. How should the Native banner Unified click and impression logic be implemented? I see that there are methods in your plug-in that can be used. I implemented click and it redirects to a sample ads page. WIll it be enough? How should we implement impression logic? Should I call RecordImpression() method after 30-60 seconds when the banner is shown? Should I call RequestBanner() again after it to get a new one?
4. When I tried to see how the native banner unified looks like with Production keys in my build without uploading it to the google play, I got Internal Error in the logs in the method HandleNativeAdFailedToLoad(object sender, AdFailedToLoadEventArgs args). Is it a normal behavior? Do you have a specific check not to allow these production keys for dev builds? I just worry that if we upload the build into google play Prod environment, we'll have the same issue. We need to use native ads unified as we want to have a banner with margins, so it fits better in our UI. I could add margins inside of your plug-ins, but you're using Proguard now) Maybe you could add margins as an additional variable in future for regular banners? As we're using such a banner on a gameplay screen.
5. Also what I'd like to mention that it's not so good to have ads showing in an update method. Right now you have an update method where you set the ads to all of the possible elements: <snip> And on Qualcomm 835 instead of 60 FPS that we had, we have 20. Partially it happens because you call Find() Method, which is expensive, but also it could be moved into a coroutine with repeating the same logic at least each 0.1 second. But ideally it would be great if you could modified the code on using events. So, the objects would be updated only when it's needed. It would safe a lot of resources.
Regards,
Ziv Yves Sanchez
Mobile Ads SDK Team
Hi Denis,
Thank you for providing an extensive rundown of your new concern with the Unified Native Ads of AdMob Unity.
I was able to make the provided sample project work by changing the Canvas' Render Mode to Screen Space - Camera, and assigning the Main Camera as the target Render Camera. Kindly see attached screenshot. Could you try the same on your end and confirm if it'll work?
Regards,
Ziv Yves Sanchez
Mobile Ads SDK Team
Hi Denis,
Glad to hear that you've got it working!
As for the question of where to find the ForUnifiedNativeAd() function in the AdLoader object: kindly refer to this guide for Unified Native Ads for AdMob Unity, specifically this section. You will need the AdMob build specifically for native ads in order to make this work.
Let me know if you have any other questions.
Regards,
Ziv Yves Sanchez
Mobile Ads SDK Team
Hi Shawn,
You only need to import the AdMob SDK that includes the native ad. Do not import the generic AdMob SDK, as that would break the SDK's file structure due to overlaps in files. You may also refer to this page to learn more about calling the ForUnifiedNativeAd() function.
If the situation persists despite the above, could you kindly provide a copy of your sample project (via Reply privately to author) so that I can further investigate the issue?
Regards,
Ziv Yves Sanchez
Mobile Ads SDK Team
Hi Ahsan,
Thank you for reaching out to us.
You may check out the documentation for the AdLoader and AdLoader.Builder classes in order to learn more about them. You may see these classes in practice in this guide for the Unified Native Ads for AdMob Unity. Do note that you will need the AdMob build specifically for native ads in order to make this work.
Regards,
Ziv Yves Sanchez
Mobile Ads SDK Team