Advertisements are a possible way to generate revenue from players playing your game. As mentioned previously, Unity Ads has two different types of ads that we can display: simple and rewarded. Simple ads are easy to use, hence the name, and allow users to have simple full-screen interstitial ads. This can be really useful for when moving between levels or perhaps for when the player wants to restart the game. Let's see how we can implement that feature now. Implement the following steps:
- To get started, we will need to add a new function to the UnityAdController class:
public static void ShowAd()
{
if (Advertisement.IsReady())
{
Advertisement.Show();
}
}
Here, we created a static method called ShowAd. We made this static so that we can access the function without actually having to create an instance of this class in order to call this function. We then check whether an advertisement is ready, and if it is, we will call the Show() function...