Home > Enterprise >  How to add banner ads as child on object unity
How to add banner ads as child on object unity

Time:03-30

I Want to place a banner ad as a child of another one to be specific google ads.

Ex placing the ad in a scroll view. If I can add the ads as a child of an object it allows me to add to the scroll view and I can position the ad much more easily.

I have searched but didn't find anything at all. Just like this Embedding ads within Recyclerview

Is there any way to add them?

If not with Ad mob, is there any other which allows doing that?

CodePudding user response:

I found a solution We can add that as a child after initialization after it is created. By using GameObject.Find(string name of object) Because the banner doesn't have a parent we can use this character '/' in this way we will find only the banner that doesn't have any parent. after that adding the parent of this object is simple. Here is an example

        GameObject loadedBanner = GameObject.Find("/ADAPTIVE(Clone)");
        loadedBanner.transform.SetParent(parent);

More info for GameObject.Find() https://docs.unity3d.com/ScriptReference/GameObject.Find.html

  • Related