Even the most altruistic game developer sometimes wants to eat, and our new cycle about
monetization can help him solve this issue.
We will open it with an article about one of the most popular options for generating income for free to play games, particularly displaying video ads.
Monetization
If you look at the opportunities for monetizing your game, then there are several main approaches:
Pay to play - take money for installing your game
In-app purchases - ask for money for additional services in the form of in-game purchases
In-app Ads - show ads
Bonus type - collect user data and sell it to someone for some money, then get a public lawsuit for violation of privacy, report to senators in the US Congress, etc. according to the worked-out scheme, but save this schema till the moment when your audience hit one billion of peoples =)
The essence of the advertising model
The scheme is quite well-known and simple, you display an ad (video or banner) in the application, and the ad network that provided it pays you a little money for views and a little more if the ad has reached the goal and the client has followed it. Essentially, this is no different from advertising on the Internet. To understand the amount of income, you will earn about a couple of dollars from a thousand impressions(the result is taken by analogy with advertising on sites and reflects only the order; this blog is not about marketing).
Ad networks
There are quite a few advertising providers, and the integration of any of them will be about the same process: setting up an account and a project in an advertising network, embedding an SDK into the current project, embedding ads into game logic.
Suppose this is your first project, or you just haven’t thought about this model, the most obvious candidate of all the networks, of course, will be the Unity Ads Network; I don’t presume to judge the real results that you can get with these ad networks, but what better way to showcase ad embedding than native experience? =)
Add integration package with Unity Ads - this part also may change over time, so I'll provide an official link too
Enable Unity Ads integration in the project. It is worth noting that it may not turn on the first time, and you will need to click on the switch again, be careful and check that everything is turned on
Create a class for working with ads - last time I use a singleton to set up an ad manager
usingSystem;usingUnityEngine;usingUnityEngine.Advertisements;usingUtils;namespaceManagers{publicclassKhtAdManager:KhtSingleton<KhtAdManager>,IUnityAdsListener{// Processing the end of the display of advertising through events
publicstaticeventActionfinishAd=delegate{};// Game Id in Unity services
privatestaticstring_gameId="";// There are three types of ads; rewardedVideo is one of the standards and does not allow you to skip ads
// More information on other types of advertising can be found in the documentation
privatestaticstringmyPlacementId="rewardedVideo";// Used to determine the ability to display ads
privatestaticbool_isAdAvailable=false;publicstaticboolIsAdAvailable=>_isAdAvailable;// Start is called before the first frame update
voidStart(){// Singleton setup
DontDestroyOnLoad(gameObject);// Configuring ad serving
Advertisement.AddListener(this);Advertisement.Initialize(_gameId);}// Display ad
publicstaticvoidShowAd(){if(ReferenceEquals(Instance,null)){return;}Advertisement.Show(myPlacementId);}// Ad load completion handler
publicvoidOnUnityAdsReady(stringplacementId){Debug.Log("OnUnityAdsReady: "+placementId);_isAdAvailable=true;}publicvoidOnUnityAdsDidError(stringmessage){Debug.Log("OnUnityAdsDidError: "+message);}publicvoidOnUnityAdsDidStart(stringplacementId){Debug.Log("OnUnityAdsDidStart: "+placementId);}// Handling ad display completion
publicvoidOnUnityAdsDidFinish(stringplacementId,ShowResultshowResult){// Define conditional logic for each ad completion status:
if(showResult==ShowResult.Finished){// Reward the user for watching the ad to completion.
}elseif(showResult==ShowResult.Skipped){// Do not reward the user for skipping the ad.
}elseif(showResult==ShowResult.Failed){Debug.LogWarning("The ad did not finish due to an error.");}finishAd();}privatenewvoidOnDestroy(){Advertisement.RemoveListener(this);base.OnDestroy();}}}
Test usage
Naturally, during development and testing, you cannot show commercials. Take this very seriously; otherwise, the ad network will ban you. Several options can enable test mode for you:
Pass parameter on initialization Advertisement.Initialize(string gameId, bool testMode)
Enable forced test mode on the project page in the Unity Dashboard with Override client test mode - Force test mode ON (i.e. use test ads) for all devices
Enable test mode in the project services settings (works only in the editor)
Apple iOs 14
With the release of the 14th version of iOs, user interaction rules with advertising messages are changing. If you are developing a game for this platform, then you will need an additional configuration. To resolve this issue, Unity has also prepared a list of necessary steps.
Underwater rocks
I want to note a few points that I periodically meet in other projects:
Don't forget to mute your game music/sounds while showing ads; otherwise, you will get sound chaos
Ads do not load instantly, so if you are making yet another idle game, then you should pay additional attention to the availability of ads right after game loading and somehow interact with the user to whom you offer to double afk bonus for watching the video
There is also a possibility that the player does not have the Internet at all (for example, he plays on an airplane), so it is necessary to handle this situation, at least show a message about the absence of available advertising
Conclusion
As always, the integration of advertising from Unity itself is not a difficult task if you follow the steps described in their documentation. If you want to use any third-party advertising providers, they usually support their documentation even better. As a result, the availability and effectiveness of this monetization method make it one of the main engines of free to play applications, which cannot but frustrate me as a player. You can still show respect for loyal users and insert an internal purchase into your game that will disable ads displaying. And we will look at how to do this in our next article, dedicated to in-game purchases, in the series about
series on monetization. See you next time! =)