Yuma 4×4

Media and Communications

Unity Packages for AdMob Mediation – Mobile Ads Garage #15

Unity Packages for AdMob Mediation – Mobile Ads Garage #15

[MUSIC PLAYING] ANDREW BROGDON: Hey, everybody. I’m agent Brogdon and welcome
back to the Mobile Ads Garage. Today, with the help of my
partner, Gary the Graphics Guy, [SWOOSH] We’re going to cover some new
resources for Unity Publishers using AdMob mediation. Now, a while back,
we did an episode in this series that talked about
open source mediation adapters for Android and iOS. I think, we had three or four
adapters for each platform at that point. But since then, we’ve
gotten that number up to an even dozen, which
we maintain in partnership with some of the networks that
have joined our open source initiative. So that’s 12 ad
sources for which we can offer Android and
iOS publishers a simplified mediation integration. [SWOOSH] Good question. The Android and iOS
adapters can really simplify things for
publishers on those platforms. But Unity is its own thing. You can’t easily call into the
native adapters from C# land to get constants out of
them or use an extras class. And, of course, if you’re
building your Unity app for both platforms,
you still have to go out and get two native
adapters and two matching SDKs. So to simplify these
complexities for our Unity publishers– get the trumpets ready– we’re releasing
network-specific Unity packages for AdMob mediation. [TRUMPET SOUNDS] These packages work with
the AdMob Unity plug-in to automatically fetch and
include the appropriate iOS and Android adapters for
their matching network, and where possible,
the mediated SDKs too. In addition, there’s Unity
code that wires a C# interface to things like bundle
builders and extras classes– all those little details
found in some of the adapters. That way, you can access them
without leaving the comfort of your C# code. So let’s take a look
at how this works and import a few
of these packages into a sample Unity Project. OK, so here we are
in a fresh terminal. And I’m going to start by
cloning the Google Mobile Ads Unity repo, which
is hosted on GitHub. That includes the source
for our Hello World sample app, which I’m going to
be using in this video, just to give me a project
to import the mediation packages into. Here we go. We get into Samples. Cool. Now, when you open Hello
World and the Unity editor, you get this. It’s an empty scene because
all the action takes place in a script file, which
is perfect for this demo because we’re going to
be talking about code. So first things first. I need to get the AdMob plug-in
for Unity from this page. And this is the Releases
tab from the repo you just saw me clone– Google Ads Mobile Unity. It has handy prepackaged
builds of the plug-in. And when you import one of them,
you see something like this. There’s a bunch
of stuff in there. And you should import all of it. Now, once that’s done,
Unity is going to chug away for a second or two. And there we go. So now, the plug-in is
imported and AdMob is now available in my Game Scripts. So let me open that up. And there it is. This script builds an entire
UI in the OnGUI Handler. And when it runs, the
UI looks like this. So you can see, I’ve
got a test ad loaded. So the plug-in is working. And if I were just using AdMob,
I can actually stop here. I’ve got everything I
need to show AdMob ads. But I want to use mediation. So the next stop is the
AdMob Unity Mediation Guide. It lists a bunch of details
about how mediation works. But more importantly
for our purposes, it has the list of open-sourced
and versioned adapters. And these are the
ones we’re rolling out Unity packages for
though we don’t have total coverage already. Now, I’m just going to pick one. Let’s go with AppLovin here. I’m going to open up this guide. And this is the end-to-end
guide for mediating AppLovin with AdMob in Unity. Now, if you haven’t seen
one of these guides, they walk you
through all the steps of configuring AppLovin
and AdMob to work together, including step 3 here,
Importing the Adapter and SDK with the Plug-In. So now, I’m on [INAUDIBLE]. Let me write to this zip file. And this is where we’re
hosting our Unity packages. And I can click right
here and grab it. Now, once I do that,
and I’ve downloaded three of these in advance,
you can watch me import them. They’re going to be
imported right here. They got a bunch of files. Again, you want to make sure you
get everything in the package. So that’s AppLovin. And Unity check away. Now, I’m going to
grab another one. Let me back out here. And let’s go with Unity Ads. You can see, there’s a lot
less code and assets included with the Unity Ads package. And that’s because with Unity,
there isn’t anything that we have to wrap a C# skin around,
like we do with AppLovin, as you’ll see you in a second. So the package there
is much simpler. It’s just pulling in the
SDK and the native adapters. Vungle, again– this
has an extras class that comes with it to
make adding extras easier. So that has a lot of stuff. And again, make sure
you import everything. And there we go. I’m going to build and
run just to make sure I’ve got everything right here. We’ll let Unity chug away
as it pulls it all together. And there’s my app once more. And it’s running just fine. So now, I’ve got the AdMob
plug-in plus three mediation packages in there. And I’m ready to go. So that’s the basics of
where to get the adapters and how to get them
into your project. Now, let me show you how to get
at the custom Unity code that’s in some of these adapters,
and how it can make tasks like adding extras easier. Back into the IDE. OK, so say you’re reading
through our Vungle Mediation Guide for Unity, and
you hit this spot. Now, Vungle’s SDK needs to
be initialized at app launch. With every Vungle placement,
you’re going to load ads for it during the execution of the app. And that’s not a
paradigm that maps well to AdMob’s architecture
for adapters. But because we have a
Unity package specifically for Vungle, it can
offer this extras class. So if I go back to
my Game Scripts, I can import the
namespace for Vungle mediation right up here,
alongside the rest of my using statements. Dot mediation– there we go. And then, I can scroll
down and reference it while building my request. And I’m actually just going to
paste in the code you just saw in the Vungle Mediation Guide. There it is. This builds an instance
of that extras class and adds some example
Vungle placement IDs to it. This class is coming straight
out of the Vungle package. And I can use a
compiler directive to fill it with
different placements based on the platform. Now, I just need to use
the Add Mediation extras method in the Add
Request Builder to get the object I just created
included with my add request. And the Mobilize SDK will
take care of the rest. There we go. Let me get this tabbed over. So that’s an example
of an extras class that’s included with one
of the mediation packages. But how about just a method? If you’ve ever used
AppLovin, for example, you know that they require
you to run your app and initialize the AppLovin
SDK as part of the registration process. In Unity, that could be a real
han-up since you’d have to wire up C# code to a client that
would call the appropriate init method on iOS or Android. So we’ve done that work
for you in the package. Included in the AppLovin
mediation package is a static
initialize method that will invoke the right method in
the date of SDKs for AppLovin. You can just import
the namespace and put it to work in your start
method as I’m doing right here. And if we go back to the
end-to-end guide for AppLovin, you’ll see detailed
instructions for where to put your AppLovin SDK key as
well, so their SDK can find it. And that’s the goal for
us– for each network to have an end-to-end
guide and Unity package, making the integration
process as smooth as possible. All right, so that’s
it for this episode. But as always, I’ve got
some resources for you. [SWOOSH] Actually, yes, there’s really
only one page you need. And that’s our Unity
Mediation Guide. It’s got a list
of the networks we support for Unity and an
individual guide for each one. I put a link down below
in the description. There’s also a link to
our SDK Support Forum, where you can post
technical questions and get answers from our team. And of course, if you have
a question about this video, or an idea for a topic
you’d like us to cover, leave a comment below. And Gary and I will
see you next time. [MUSIC PLAYING]

20 thoughts on “Unity Packages for AdMob Mediation – Mobile Ads Garage #15

  1. This is awful tutorial. I've spend 4 hours and still cannot get vungle work. Should I download it SDK seperately? U did not mention that in video.


    You should study from Heyzap. They have great single download page for all sdk

  2. My Admob account is linked with Adsense but Ads are not visible in night after 10 pm, only day for certain time why?

  3. You should do one plugin that allows you to show the ad on the scene by just adding one prefab to the scene. This prefab should have a string with the Ad ID and the developer does not have to interact with the code. there should be one prefab for each kind of ad (banner, rewarded video, interstitial). This will make all easier. Thanks for reading me.

  4. I think that Admob plugin doesn't work properly on Unity. Have you tried to load and show 4-5 rewarded videos (not all together, just 1 by 1, watching then closing them), on android? Does it work or after some videos.. THE GAME FREEZES HORRIBLY, due to a multithreading that Unity still does not support properly? How have you solved it?

  5. This video is good and clear but why you choose "vungle"! and this company need addition code , but facebook , unity3d , adcolony no need, in next time please explain most popular advertisement company

Leave comment

Your email address will not be published. Required fields are marked with *.