Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 CyberModeSoftware · Jun 06, 2021 at 09:38 PM · adsunityads

Why my ads is not visible on final build just in editor?

I have some ads on my game like reward video and interstitial video Reward video needs to play when i pres the +20k money button and interstitial when you select a car. In editor everything works perfect but in build nothing work I tried all methods that i find on the internet but is the same problem.

interstitial ad :

     public string mySurfacingId = "Interstitial";
     string gameId = "4****9";
     bool testMode = false;
 
     void Start()
     {
         // Initialize the Ads service:
         Advertisement.Initialize(gameId);
     }
 
     public void ShowInterstitialAd()
     {
         // Check if UnityAds ready before calling Show method:
         if (Advertisement.IsReady())
         {
             Advertisement.Show(mySurfacingId);
             // Replace mySurfacingId with the ID of the placements you wish to display as shown in your Unity Dashboard.
         }
         else
         {
             Debug.Log("Interstitial ad not ready at the moment! Please try again later!");
         }
     }

video reward :

 private string gameId = "4****9";
 
 
     Button myButton;
     public string mySurfacingId = "rewardedVideo";
     public MoneyMNG Money;
     public bool testMode;
     void Start()
     {
         myButton = GetComponent<Button>();
         Advertisement.Initialize(gameId,testMode);
 
         // Set interactivity to be dependent on the Ad Unit or legacy Placement’s status:
         myButton.interactable = Advertisement.IsReady(mySurfacingId);
 
         // Map the ShowRewardedVideo function to the button’s click listener:
         if (myButton) myButton.onClick.AddListener(ShowRewardedVideo);
 
         // Initialize the Ads listener and service:
         Advertisement.AddListener(this);
         
     }
 
     // Implement a function for showing a rewarded video ad:
    public void ShowRewardedVideo()
     {
         // Check if UnityAds ready before calling Show method:
         if (Advertisement.IsReady(mySurfacingId))
         {
             Advertisement.Show(mySurfacingId);
         }
     }
 
     // Implement IUnityAdsListener interface methods:
     public void OnUnityAdsReady(string surfacingId)
     {
         // If the ready Ad Unit or legacy Placement is rewarded, activate the button: 
         if (surfacingId == mySurfacingId)
         {
             myButton.interactable = true;
         }
     }
 
     public void OnUnityAdsDidFinish(string surfacingId, ShowResult showResult)
     {
         // Define conditional logic for each ad completion status:
         if (showResult == ShowResult.Finished)
         {
             // Reward the user for watching the ad to completion.
             PlayerPrefs.SetInt("Money", PlayerPrefs.GetInt("Money") + 20000);
             Money.Update2();
             Debug.Log("Rewarded");
         }
         else if (showResult == ShowResult.Skipped)
         {
             // Do not reward the user for skipping the ad.
            
         }
         else if (showResult == ShowResult.Failed)
         {
             
         }
     }
 
     public void OnUnityAdsDidError(string message)
     {
         // Log the error.
     }
 
     public void OnUnityAdsDidStart(string surfacingId)
     {
         // Optional actions to take when the end-users triggers an ad.
     }

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

164 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

Related Questions

I can not build my project after I imported Ironsource SDK. 2019.4.5f1 0 Answers

Unity ads not showing rewarded video ad. 1 Answer

UnityAds vs AdMob 0 Answers

How to delete app on UnityAds? 1 Answer

While Unity Ads are shown game pause on Android but not on iOS? 2 Answers


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