Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by aedifexgames · Oct 15, 2020 at 05:21 PM · adspackageinterface

Unity Ads IUnityAdsListener.OnUnityAdsDidFinish NotImplementedException. Fixes?

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.Advertisements;
 using UnityEngine.SceneManagement;
 
 public class AdManager : MonoBehaviour, IUnityAdsListener
 {
     string AppStore_ID = "3862326";
     bool testMode = true;
     string myPlacementId = "rewardedVideo";
     bool runningPauseAd;
     bool loadSceneOnDone;
     string sceneToLoad;
     public bool premiumNoAds;
 
     // Start is called before the first frame update
     void Start()
     {
         Advertisement.Initialize(AppStore_ID, testMode);
         Advertisement.AddListener(this);
     }
 
     public void DisplayInterstitialAd()
     {
         if (Application.internetReachability == NetworkReachability.NotReachable)
         {
             //Give internet connectivity feedback here
 
             return;
         }
         Advertisement.Show();
     }
 
     public void DisplayVideoAdAndPauseGame()
     {
         if (Application.internetReachability == NetworkReachability.NotReachable)
         {
             //Give internet connectivity feedback here
 
             return;
         }
         print("Running Video Ad...");
         Time.timeScale = 0;
         runningPauseAd = true;
         Advertisement.Show(myPlacementId);
     }
 
     public void DisplayVideoAdAndPauseGameAndLoadScene(string scene)
     {
         if (Application.internetReachability == NetworkReachability.NotReachable)
         {
             //Give internet connectivity feedback here
 
             return;
         }
         print("Running Video Ad...");
         Time.timeScale = 0;
         runningPauseAd = true;
         sceneToLoad = scene;
         Advertisement.Show(myPlacementId);
         
     }
 
     public void DisplayVideoAd()
     {
         if (Application.internetReachability == NetworkReachability.NotReachable)
         {
             //Give internet connectivity feedback here
 
             return;
         }
         print("Running Video Ad...");
         Advertisement.Show(myPlacementId);
     }
 
     // Implement IUnityAdsListener interface methods:
     public void OnUnityAdsDidFinish(string placementId, ShowResult showResult)
     {
         // Define conditional logic for each ad completion status:
         if (showResult == ShowResult.Finished)
         {
             // Reward the user for watching the ad to completion.
             print("Ad watched to completion");
             OnAdWatched();
         }
         else if (showResult == ShowResult.Skipped)
         {
             // Do not reward the user for skipping the ad.
             print("Ad skipped");
             OnAdSkipped();
         }
         else if (showResult == ShowResult.Failed)
         {
             Debug.LogWarning("The ad did not finish due to an error.");
         }
         throw new System.NotImplementedException();
     }
 
     private void OnAdWatched()
     {
         if (runningPauseAd)
         {
             Time.timeScale = 1;
             runningPauseAd = false;
         }
         if (loadSceneOnDone)
         {
             SceneManager.LoadScene(sceneToLoad);
             loadSceneOnDone = false;
         }
     }
     private void OnAdSkipped()
     {
         if (runningPauseAd)
         {
             Time.timeScale = 1;
         }
         if (loadSceneOnDone)
         {
             SceneManager.LoadScene(sceneToLoad);
             
         }
     }
 
     void IUnityAdsListener.OnUnityAdsReady(string placementId)
     {
         // If the ready Placement is rewarded, show the ad:
         if (placementId == myPlacementId)
         {
             
         }
     }
 
     void IUnityAdsListener.OnUnityAdsDidError(string message)
     {
         // Log the error.
     }
 
     void IUnityAdsListener.OnUnityAdsDidStart(string placementId)
     {
         // Optional actions to take when the end-users triggers an ad.
     }
     void OnDestroy()
     {
         Advertisement.RemoveListener(this);
     }
 }
 

Every time OnUnityAdsDidFinish() is called, a NotImplementedException is thrown, and the user is not rewarded for the ad. I am using the Advertisement Package (v3.4.2) through the Package Manager. Any fixes?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

214 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Unity ads working on device, not working in editor 1 Answer

Facebook SDK Audience Network 4.28.2 Ads integration error in unity3d 2017.3.0f3. pls Help 0 Answers

Why Unity Ads are not showing every time? 0 Answers

Multiple AdvertisementManager, one for every Scene? 0 Answers

Advertisement error when load new scene,Ads shows error when load scene 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges