Welcome back.
In this video, we'll have a look at how to add ads to our game because you might want to monitor your
game and make some money off of your game.
And one great way to do that is through unity ads.
And we are going to add those in this video.
So let's open up a new window called services here.
And in order to add services such as ads, you need to be logged in.
So you need to be logged in to your unity account.
And if you don't have one, you need to create one.
So go ahead.
And so go to Unity three dot com and create a new account.
So here you can go to create a unity ID and then simply do that because you will need that in order
to add ads to your game.
So here you can choose your organization.
In my case, it's just my name and I'm going to create a new service so you can add analytics, cloud
builds, performance reporting, in-app purchasing, those kind of things.
And we'll look at ads this time.
So let's click on ads.
And it's activate that.
You can also check if you want to target the game for children under 13 and you would need to check
mark here and otherwise you can simply continue.
As you can see here, these are three supported platforms that that unity adds supports.
Right?
Then click on continue.
So let's do that again.
Let's activate it.
And after that's done, you can see here getting started, you can learn more.
So let's open that up there.
You will find information about how to get all of that running on Android, studio and Xcode and so
forth.
Now you can do the integration here, the unity engine integration and so forth.
And I'm going to simply show you how how it's done quite easily.
You can, first of all, enable the test mode because we're currently just going to test that during
our development so we can test that on our machine as well or on a PC or Mac in order to get the ads
now into our game, we of course need to add a script for that.
And luckily we already have a script which can take care of that, and that's our game manager.
And next, what we need to do is if you haven't done that already, you need to go to your build settings
and change to an Android build.
So switch platform.
Next.
You can close that and go to your game manager, to the inspector, and in here, open the game manager.
And now let's add a namespace for that unity engine dot advertisements.
That's the one we need.
And India wake method.
We need to call advertisements.
Dot, initialize and initialize needs the game ID.
And how do you get the game ID?
Well, you'll find it in your services and then go to dashboard.
And in there you will find the ID for Android and the one for Unity.
So Fruit Ninja Clone Version one.
As you can see, no revenue yet.
And actually here go to platforms and there you will find the Google play store ID and you can set up
what you want to show video after five, 5 seconds you can activate it or deactivated rewarded video.
You can allow those kinds of things.
So let me go back here and copy that number that we have here on the platforms.
Actually you can go to settings and copy it from here.
So I'm going to copy that and enter it in my script here in quotation marks.
Next, I need to say when I want to show the advertisement and a great position for that would be whenever
we hit a bomb so we could just say, Here, advertisement.
That show.
Now save that script, and now you can build that on your Android device.
Now let's test it in unity.
However, in our game here.
So let's lose again or let's hit the bomb.
And you see, this screen would be your ad unit.
Everything seems to be working now.
You can skip that or you can close it.
So both will do the same thing.
You go back to your game and the player can go ahead.
Now let's see if that happens again.
Once we go to the hit bomb again or one on hit bomb gets called our method.
Well, as soon as a bomb comes up, let's hope that happens very soon.
All right.
There we are.
And again, this screen would be your ad unit.
Everything seems to be working.
So if you test that on your Android device, they will actually an ad run and you can see how that looks.
Now, how do you actually make money with ads?
Usually just showing ads like that is not the most lucrative way.
It's, of course, best if you have some sort of rewarding system.
So if somebody watches the ad I like, let's say a 30 seconds ad that that player gets an amount of
coins or gets an amount of resources in your game, that would be a great situation to use ads where
you can actually profit from it the most.
People are more willing to watch an ad and maybe even install the game or whatever.
Click on the ad if they know that they get rewarded within the game and there is an actual incentive
to do so.
All right.
So keep that in mind when building your game.
If you want to make money with it, just try to think about it before you build the game.
Just build a concept which will most likely make you most money.
All right.
And the next video, you will see how to set up your device so that you don't get rewarded for clicking
on your own ads.
Because if you constantly click on your own ads, you get punished for it.
And that's not really what you should want, because then you might you might be deactivated or your
ads might be deactivated completely, and you won't make money off of it.
So see you in the next video.