Unity

Unity Gaming: Unity Ads (part 2)

Implementing Unity Ads

In my last post Unity Ads (part 1) I talked about the importance of Ads, why you need them, and how you should implement them.

Step 1: Sign-Up

Make sure you have a Unity Account before you get started. You will also need a Unity Services account as well. To get one go to https://unity3d.com/services/ads to sign-up and try the free beta.

1-1UnityAdsSignUp

Click “Earn Money with Your Games”.

1SignUpDecision

If you have never created an ad service before your dashboard will prompt you to create a new Ad Project. Do NOT create a new project.  If you create a new project you will have to link the ID that is generated from your editor to this project. Instead, we will create the Ad portion of your project in Unity’s Project Editor.

2-3SignUpProjectOnline

Step 2: Enable Unity Services

Now that you have an account you need to open your game in unity. In the upper right hand corner of the Editor you should see the unity services tab (if you don’t see the tab, hit the cloud icon in the upper right).

ServicesCloud

Before you can enable start using Ads you need to create a Unity Project ID so you can collect your data and view it with Unity’s Analytic Dashboard.

Select “Create” to have Unity create a Unity Project ID.

2EnableUnityServices

Step 3: Enable Unity Ads

After you’ve turned on services and connected generated your Unity Project ID. You should see the available services that Unity provides within the Editor. Currently Analytics and Ads are the only ones available, however multiplayer options and Cloud Build are in the pipeline for future integration and use with the editor.

Turn on Ads by clicking the “Off” toggle to “On” for Ads.

2EnableAds
2-1EnableAds

To link this project with our online portal simply click “Go to Dashboard”.

2-1-2AdsCreateProject

The portal for your project should now open in your browser.

3-1Dashboard
3-2Dashboard

Step 4: Ads Integration

Now that your project is linked to Unity Ad Services, let’s get some ads in your code. There are two types of Unity Ads:

  1. Simple
  2. Rewarded

To explain these two types, I’ll start with Rewarded. Rewarded Ads keep track of whether or not the player has skipped your ad, or has completed watching the ad. This allows the developer to then reward the player after the completion of the advertisement.

Simple Ads are ads that simply run in your application without any other interaction with your application.

Unity provides some sample code for you to run in your project, which makes it really easy to plug and play with the feature.

2-2EnableCodeSamples

In order to test out your ads, make sure that the “Enable Test Mode” button is selected

3-3EnableTestMode

Also ensure that you are building to the iOS or the Android Platform.

3-4BuildSettings

When you run the code the ads should look like this:

4-1-1AdShowing

And there you have it. Integrated ads in your game!

Happy Hacking!

-TheNappingKat

Leave a Comment

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