In-editor test ad
If your app is made-with-Unity by using C#, when you have written the script to initialize the Unity Mediation SDK, as well as create, load, and show an ad object for interstitial or rewarded ads, use the In-Editor Test Ad feature in the Unity Editor to ensure that your game script implementation is set up correctly.
Use the In-Editor Test Ad feature to perform the following actions through a simple visual indication in your Editor in the Scene of your project:
- Verify that the C# callbacks in your project are being fired and confirm their status in the project console.
- Verify the ad setup in your code and ad script implementation for your made-with-Unity app.
- Catch any bugs, mishandled methods, or empty ad unit fields.
- Get quick feedback on your C# implementations without going through a long app build.
Note: The Test Ad does not show an actual ad unit in your project or a real ad, but serves more as a visual cue to notify you if the ad setup in the code is valid.
How it works
The In-Editor Test Ad feature is out-of-the-box in your Unity project. If the Unity Mediation SDK is integrated correctly in your project, and you have imported the Sample Mediation project from the Project Manager, then you can see the test ads and the correct ad setup scripts as a reference before you attempt your own integrations.
To use the In-Editor Test Ads to validate your C# callbacks, complete the following steps:
Open your project in the Unity Editor and go to Window > Package Manager.
In the Package Manager, select the Mediation package and go to the Samples section. Select Import into Project to download the Sample project.
Ensure that you are connected to a project through the Services window (Window > Services).
Open the Sample Scene that you downloaded by selecting Assets > Samples > Advertisement with Mediation > 1.0.0-pre.6 > Example Usage > MediationExample.
From the MediationExample Scene, go to the Canvas object and select either InterstitialExample or RewardedExample.
In the Inspector, go to the script section. Populate the script fields with the necessary Ad Unit IDs.
Press Play to enter Play Mode.
The Console updates with messages that indicate the Unity Mediation SDK is working, such as for example, that the SDK is initialized successfully and that your ads are loaded.
Select Show Interstitial or Show Rewarded from your Scene to see the in-Editor Test Ad.
Note: To interact with either button, you need to fill out the respective ad units of the Interstitial and/or Rewarded ads in the Inspector.
If you select Show Interstitial, the following screen displays:
If you select Show Rewarded, the following screen displays:
Note: If the Console mentions that a gameID cannot be found, ensure that you are signed in to your project, and then go to the Mediation Settings Window (Services > Unity Mediation > Configure) to confirm that your project is configured for the Mediation service.