1
votes

In my android app which Im developing in unity I use admob for my advertising. The banner works fine but I want to reward a player when they watch an advertise. There is no solid explanation or tutorial on how to setup rewarded advertises for unity on the web that I can find. I setup unity ads for my mediation in admob and have almost no clue what ZoneId means. I just entered the integration Id on unity ads which was "rewardedVideo".

I then entered the ad unit id into the googleplaydemoscript in unity and ran it, when I pressed the request and show rewarded video nothing happened.

Can someone please give me a guide on how to setup rewarded ads in unity with admob? Thanks.

2
Why not use Unity build in Ad API?Programmer
Im confused, what?Physix
You want to use Ad in Unity? You are using a admob plugin in Unity. I am saying that Unity has a built in API for displaying Ad/Video and this can be easily done with Unity's Ad API instead of using external plugin from admob.Programmer
I have a banner I am using with admob. I want the rewarded video to be part of admob as well so I can all manage it all in one place instead of managing both unity ads and admob separately.Physix
I know what you want to do. I am just telling you that you can use Unity's API to do that. It looks like you to stick with Admob. Do you have a code? Can you at-least post a code you currently have that doesn't work?Programmer

2 Answers

3
votes

Look that answer from groups google.

https://groups.google.com/forum/#!category-topic/google-admob-ads-sdk/ZxbVL60cHFo

Check if your problem is correct folder for mediation setup.

2
votes

Enable Ads in Unity

First, set the build targets and enable Unity Ads in the Services Panel.

  1. Open your game project, or create a new Unity project.
  2. Select Edit > Build Settings and set the platform to iOS or Android
  3. Enable Ads in the Unity Services window.

Once that's done, select Window > Services. Select an Organization from the drop down menu: Click Create.

Click Ads, and enable the SDK in your project:

Add the code

  1. First, declare the Unity Ads namespace in the header of your script

    using UnityEngine.Advertisements;

  2. Then, you can display an ad by calling the following method

    Advertisement.Show();

Example Code

Add a button to your scene that plays an ad, then handles status and callbacks.

Step 1: Select Game Object > UI > Button to add a Button in your scene

Step 2: Add the following script to the button:

      using UnityEngine;
        using UnityEngine.Advertisements;

        public class UnityAdsExample : MonoBehaviour
        {
          public void ShowRewardedAd()
          {
            if (Advertisement.IsReady("rewardedVideo"))
            {
              var options = new ShowOptions { resultCallback = HandleShowResult };
              Advertisement.Show("rewardedVideo", options);
            }
          }

          private void HandleShowResult(ShowResult result)
          {
            switch (result)
            {
              case ShowResult.Finished:
                Debug.Log("The ad was successfully shown.");
                //
                // YOUR CODE TO REWARD THE GAMER
                // Give coins etc.
                break;
              case ShowResult.Skipped:
                Debug.Log("The ad was skipped before reaching the end.");
                break;
              case ShowResult.Failed:
                Debug.LogError("The ad failed to be shown.");
                break;
            }
          }
        }

Then simply press the editor Play button to test the Unity Ads Button integration.