Creating Rewarded Video Ads in Unity
Objective: Set up Unity Ads
We start off by adding a button to the shop panel UI to click here for 100G(Gems). Next we need to open Unity Services so go to Window, General and Services.
Open General settings and assign an organization(if you have one set up) or create one and then assign it before creating a project ID. You will be asked if the app will primarily target children under 13. In this case we can say no.
Click save, close the project settings and click on ads in the services menu. From here turn on Ads and enable test mode.
Test mode allows us to simulate Unity Ads in the editor. Click on Dashboard in the Ads section and it will open a web browser showing your project.
In the meantime, create a new script called AdsManager. Create an empty object in the hierarchy called AdsManager and attach the script. Open the script and create a public void ShowRewardedAd method. Connect the button we created earlier on the shop panel to the method using the OnClick section in the inspector.
In order to use the Ads in the script add the namespace UnityEngine.Advertisements to the script.
Next go back to the Dashboard that opened in the browser.
We will use the Rewarded Android option for the Ad. Following Unitys Integration Guide, we set up the attributes for the game id etc.