Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug Unity Ads 3.7.5 and 4.1.0 LoadListener always call the OnUnityAdsFailedToLoad

Discussion in 'Unity Ads & User Acquisition' started by xGeorgeV, Apr 27, 2022.

  1. xGeorgeV

    xGeorgeV

    Joined:
    Aug 8, 2013
    Posts:
    63
    I used the Unity Ads developer integration guide.

    After "Advertisement.Load("Android_Interstitial",this);" the Unity Ads SDK always call only the OnUnityAdsFailedToLoad() event with Timed_out error.

    The ads are loaded, the "Advertisement.Show("Android_Interstitial");" shows the ads.

    With Unity Ads 3.7.5 I can check the loaded ads with Advertisement.IsReady(),
    but in Unity Ads 4.1.0 does not contain Advertisement.IsReady().

    Please put Advertisement.IsReady() back in the Unity Ads 4.1.0 and above.
    Advertisement.IsReady() works fine.

    Another problem found. There is no close (X) button on interstitial ads.
     
    Last edited: Apr 28, 2022
    Karunadevi likes this.
  2. helloroy

    helloroy

    Joined:
    Jun 23, 2016
    Posts:
    42
    Last edited: May 11, 2022
    xGeorgeV likes this.
  3. SamOYUnity3D

    SamOYUnity3D

    Unity Technologies

    Joined:
    May 12, 2019
    Posts:
    597
    If you are using Unity Ads SDK 3.7.5, you need to enable perPlacementLoad to use the Load method, otherwise a Timeout error will occur.
    https://docs.unity3d.com/Packages/c...UnityEngine.Advertisements.Advertisement.html

    Starting from 4.0.0, the Unity Ads SDK does not need to enable perPlacementLoad during initialization to use the Load method.
    https://docs.unity.com/ads/InitializingTheUnitySDK.html

    Regarding the no close (X) button problem you mentioned, please contact Unity Ads Support with the following information:
    * Game ID
    * Unity Ads SDK version
    * Device information
    * A screenshot of the End card page for this ad and a screenshot of the build info page.
     
  4. xGeorgeV

    xGeorgeV

    Joined:
    Aug 8, 2013
    Posts:
    63
    Same problem with Unity Ads 4.2.1 (with Unity 2020.3.35f1).

    Advertisement.Initialize( sUnityAdsAndroidGameID, false, this );
    Advertisement.Load( "Android_Interstitial", this );

    OnUnityAdsFailedToLoad:
    I/Unity: Error loading Ad Unit: Android_Interstitial - TIMEOUT - [UnityAds] Timeout while loading Android_Interstitial

    PLEASE PUT BACK Advertisement.IsReady() IN THE Unity Ads 4.2.1 AND ABOVE!
    Advertisement.IsReady() WORKS FINE! (With Unity Ads 3.7.5)
     
  5. xGeorgeV

    xGeorgeV

    Joined:
    Aug 8, 2013
    Posts:
    63
    Unity Ads 4.2.1 with Unity 2020.3.35f1.

    Advertisement.Load( "Android_Interstitial", this );
    Load the advertisment but always returns the OnUnityAdsFailedToLoad event:
    I/Unity: Error loading Ad Unit: Android_Interstitial - TIMEOUT - [UnityAds] Timeout while loading Android_Interstitial

    Advertisement.Show( "Android_Interstitial", this );
    Show the advertisement but always returns the OnUnityAdsShowFailure event:
    Error showing Ad Unit Android_Interstitial: INTERNAL_ERROR - [UnityAds] Timeout while trying to show Android_Interstitial

    From logcat:
    :: Initializing Unity Services 4.2.1 (4210)
    :: Unity Services environment check OK
    :: Unity Ads init: load configuration
    :: Received configuration for token
    :: Unity Ads event: sending start event
    :: Closing Unity Ads ad unit

    Something goes wrong...
     
  6. SamOYUnity3D

    SamOYUnity3D

    Unity Technologies

    Joined:
    May 12, 2019
    Posts:
    597
    Hi, I just tested it but didn't see the same situation, could please provide the full device log for further investigation?
     
  7. xGeorgeV

    xGeorgeV

    Joined:
    Aug 8, 2013
    Posts:
    63
    2022-06-15 11:31:55.379 11397-11430/? I/Unity: MemoryManager: Using 'Dynamic Heap' Allocator.
    2022-06-15 11:31:55.469 11397-11430/? I/Unity: SystemInfo CPU = ARMv7 VFPv3 NEON, Cores = 4, Memory = 1784mb
    2022-06-15 11:31:55.469 11397-11430/? I/Unity: SystemInfo ARM big.LITTLE configuration: 4 big (mask: 0xf), 0 little (mask: 0x0)
    2022-06-15 11:31:55.469 11397-11430/? I/Unity: Built from '2020.3/staging' branch, Version '2020.3.35f1 (18e4db7a9996)', Build type 'Release', Scripting Backend 'il2cpp', CPU 'armeabi-v7a', Stripping 'Enabled'
    2022-06-15 11:31:55.769 11397-11430/? E/Unity: [EGL] eglChooseConfig(m_EGLDisplay, configAttribs, NULL, 0, &eglConfigCount): EGL_BAD_ATTRIBUTE: An unrecognized attribute or attribute value was passed in the attribute list.
    2022-06-15 11:31:55.869 11397-11430/? D/Unity: GL_EXT_debug_marker GL_OES_texture_npot GL_OES_compressed_ETC1_RGB8_texture GL_OES_standard_derivatives GL_OES_EGL_image GL_OES_depth24 GL_ARM_rgba8 GL_ARM_mali_shader_binary GL_OES_depth_texture GL_OES_packed_depth_stencil GL_EXT_texture_format_BGRA8888 GL_EXT_blend_minmax GL_OES_EGL_image_external GL_OES_EGL_sync GL_OES_rgb8_rgba8 GL_EXT_multisampled_render_to_texture GL_EXT_discard_framebuffer GL_OES_get_program_binary GL_ARM_mali_program_binary GL_EXT_shader_texture_lod GL_EXT_robustness GL_OES_depth_texture_cube_map
    2022-06-15 11:32:05.249 11397-11430/? D/UnityAds: com.unity3d.services.core.misc.Utilities.writeFile() (line:9) :: Wrote file: /data/data/com.exiongames.exionoffroadracing/files/UnityAdsStorage-public-data.json
    2022-06-15 11:32:05.249 11397-11430/? D/UnityAds: com.unity3d.services.core.misc.Utilities.writeFile() (line:9) :: Wrote file: /data/data/com.exiongames.exionoffroadracing/files/UnityAdsStorage-private-data.json
    2022-06-15 11:32:05.249 11397-11430/? D/UnityAds: com.unity3d.services.core.misc.Utilities.writeFile() (line:9) :: Wrote file: /data/data/com.exiongames.exionoffroadracing/files/UnityAdsStorage-public-data.json
    2022-06-15 11:32:05.249 11397-11430/? D/UnityAds: com.unity3d.services.core.device.Storage.sendEvent() (line:3) :: Couldn't send storage event to WebApp
    2022-06-15 11:32:05.254 11397-11430/? D/UnityAds: com.unity3d.services.core.misc.Utilities.writeFile() (line:9) :: Wrote file: /data/data/com.exiongames.exionoffroadracing/files/UnityAdsStorage-public-data.json
    2022-06-15 11:32:05.254 11397-11430/? D/UnityAds: com.unity3d.services.core.device.Storage.sendEvent() (line:3) :: Couldn't send storage event to WebApp
    2022-06-15 11:32:05.259 11397-11430/? D/UnityAds: com.unity3d.services.ads.UnityAdsImplementation.initialize() (line:3) :: ENTERED METHOD
    2022-06-15 11:32:05.259 11397-11430/? D/UnityAds: com.unity3d.services.UnityServices.initialize() (line:1) :: ENTERED METHOD
    2022-06-15 11:32:05.269 11397-11430/? I/UnityAds: com.unity3d.services.UnityServices.initialize() (line:35) :: Initializing Unity Services 4.2.1 (4210) with game id 1047009 in production mode
    2022-06-15 11:32:05.319 11397-11430/? I/UnityAds: com.unity3d.services.UnityServices.initialize() (line:42) :: Unity Services environment check OK
    2022-06-15 11:32:05.489 11397-11883/? I/UnityAds: com.unity3d.services.core.configuration.InitializeThread$InitializeStateConfig.execute() (line:1) :: Unity Ads init: load configuration from https://configv2.unityads.unity3d.com/webview/4.2.1/release/config.json
    2022-06-15 11:32:05.844 11397-11883/? I/UnityAds: com.unity3d.services.core.configuration.InitializeThread$InitializeStateLoadWeb.execute() (line:1) :: Unity Ads init: loading webapp from https://config.unityads.unity3d.com...44b592197df4d8602a835ccb0b/release/index.html
    2022-06-15 11:32:10.934 11397-11397/? I/chromium: [INFO:CONSOLE(7)] "Viewport argument key "viewport-fit" not recognized and ignored.", source: file:///storage/emulated/0/Android/data/com.exiongames.exionoffroadracing/cache/UnityAdsCache/UnityAdsWebApp.html?platform=android&origin=https%3A%2F%2Fconfig.unityads.unity3d.com%2Fwebview%2F4.0.0%2Fd70a756f493f1244b592197df4d8602a835ccb0b%2Frelease%2Findex.html&version=d70a756f493f1244b592197df4d8602a835ccb0b (7)
    2022-06-15 11:32:15.984 11397-12027/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:1) :: Requesting configuration from https://publisher-config.unityads.u...nId=8771480508779577542&first=true&framework=[object Object]&adapter=[object Object]&userLevelFlagDetected=false
    2022-06-15 11:32:16.534 11397-12027/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:1) :: Received configuration for token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhZyI6IjZ4Kzd0aFplUk5ITGlqbDlIb1NJc1hoSzhQY2gvUHJpejZUZG44TXZIaXh1VXErUldZOUI3WUtSb2VobHFpMHFTcjE0eVE9PSIsImFwcCI6MTU5LCJhcHBMZXZlbENvcHBhIjpmYWxzZSwiYXR0IjowLCJhdWMiOjE0MCwiYXVpIjowLCJhenAiOiI0ZDQ1ZGQ1Mi1iYTM4LTQxOGUtYmZiOS04NTQ1YjU2NWZkZTUiLCJjYWxjdWxhdGVkQ29wcGEiOmZhbHNlLCJjb25zZW50Ijp0cnVlLCJjb250ZXh0dWFsT25seSI6ZmFsc2UsImNwaSI6OTcsImNyZWF0ZWQiOjE0NTgwNjE4MjUwMDAsImRsdCI6MCwiZHQiOjAsImV0dCI6WzIxNDc0ODM4MTQsNTMyMyw0MTU2LDUxODMsNTM0NSw1MjUyLDUzNDksNTI3Ml0sImV4cCI6MTY1NjQ5NTEzNiwiaWFwIjoxNjgsImlhdCI6MTY1NTI4NTUzNiwiaWciOiJVR2ZTT0lJb0pKTWFPb0wzNnNXakdUL1d2MFRnbHVubFg2UFJ4QlA1NlBEZjNqK1J4aHVITG5HQVozcXRJbk91bjVYS1JBPT0iLCJpbnN0YWxsYXRpb25JZCI6IjgwYWI1NDg0ZWRkM2I1MzdhYjQwYTA1OWI2Y2UwZDFkIiwiaXNzIjoiYWRzLXNkay1jb25maWd1cmF0aW9uLnVuaXR5YWRzLnVuaXR5M2QuY29tIiwibGVnYWxUZXJyaXRvcnkiOjEsImx0diI6MTk5LCJtaXhlZCI6ZmFsc2UsInBybyI6MjQxLCJwcm94aWVkIjpmYWxzZSwic3ViIjoia1N6RmZuSG43bDhXOUp6WWV3dGFQMHZ2U01SVllaZGNTMzl0Vkk0WG5nbytidldKbFRsK3lDWGN6TXk0V1BtWmRoTjJRZz09IiwidGd0IjowLCJ4cHIiOjIwOH0.iPt4rjsFQ2rqS4NH2PM9uRWQ8SIX_rQw7AB7sB0RdDA (A/B group 2)
    2022-06-15 11:32:16.999 11397-11430/? I/Unity: Unity Ads initialization complete.
    2022-06-15 11:32:17.019 11397-11430/? I/Unity: UnityAdsAndroid.LoadInterstitialAd()
    2022-06-15 11:32:21.729 11397-12027/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:1) :: Requesting ad plan from https://auction.unityads.unity3d.co...nHeight=720&connectionType=wifi&networkType=0
    2022-06-15 11:32:25.764 11397-12027/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:1) :: Webview started using the latest version
    2022-06-15 11:32:47.054 11397-11430/? I/Unity: Error loading Ad Unit: Android_Interstitial - TIMEOUT - [UnityAds] Timeout while loading Android_Interstitial
    2022-06-15 11:32:59.929 11397-11430/? I/Unity: UnityAdsAndroid.ShowInterstitialAd()
    2022-06-15 11:33:00.844 11397-12027/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:1) :: Opening performance ad unit with orientation LANDSCAPE, hardware acceleration enabled
    2022-06-15 11:33:01.479 11397-11397/? I/chromium: [INFO:CONSOLE(97)] "TypeError: Cannot call method 'substring' of undefined", source: file:///storage/emulated/0/Android/data/com.exiongames.exionoffroadracing/cache/UnityAdsCache/UnityAdsWebApp.html?platform=android&origin=https%3A%2F%2Fconfig.unityads.unity3d.com%2Fwebview%2F4.0.0%2Fd70a756f493f1244b592197df4d8602a835ccb0b%2Frelease%2Findex.html&version=d70a756f493f1244b592197df4d8602a835ccb0b (97)
    2022-06-15 11:33:03.174 11397-11397/? I/chromium: [INFO:CONSOLE(97)] "TypeError: Cannot call method 'substring' of undefined", source: file:///storage/emulated/0/Android/data/com.exiongames.exionoffroadracing/cache/UnityAdsCache/UnityAdsWebApp.html?platform=android&origin=https%3A%2F%2Fconfig.unityads.unity3d.com%2Fwebview%2F4.0.0%2Fd70a756f493f1244b592197df4d8602a835ccb0b%2Frelease%2Findex.html&version=d70a756f493f1244b592197df4d8602a835ccb0b (97)
    2022-06-15 11:33:06.869 11397-11397/? I/chromium: [INFO:CONSOLE(97)] "TypeError: Cannot call method 'substring' of undefined", source: file:///storage/emulated/0/Android/data/com.exiongames.exionoffroadracing/cache/UnityAdsCache/UnityAdsWebApp.html?platform=android&origin=https%3A%2F%2Fconfig.unityads.unity3d.com%2Fwebview%2F4.0.0%2Fd70a756f493f1244b592197df4d8602a835ccb0b%2Frelease%2Findex.html&version=d70a756f493f1244b592197df4d8602a835ccb0b (97)
    2022-06-15 11:33:07.359 11397-12027/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:1) :: Unity Ads event: sending start event to https://publisher-event.unityads.un...35a1613b2100486be708-6089fdfd5f830b53cac1eabf
    2022-06-15 11:33:10.774 11397-11397/? I/chromium: [INFO:CONSOLE(97)] "TypeError: Cannot call method 'substring' of undefined", source: file:///storage/emulated/0/Android/data/com.exiongames.exionoffroadracing/cache/UnityAdsCache/UnityAdsWebApp.html?platform=android&origin=https%3A%2F%2Fconfig.unityads.unity3d.com%2Fwebview%2F4.0.0%2Fd70a756f493f1244b592197df4d8602a835ccb0b%2Frelease%2Findex.html&version=d70a756f493f1244b592197df4d8602a835ccb0b (97)
    2022-06-15 11:33:10.984 11397-12027/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:1) :: Unity Ads event: sending first_quartile event to https://publisher-event.unityads.un...35a1613b2100486be708-6089fdfd5f830b53cac1eabf
    2022-06-15 11:33:12.744 11397-12027/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:1) :: Requesting ad plan from https://auction.unityads.unity3d.co...nHeight=720&connectionType=wifi&networkType=0
    2022-06-15 11:33:16.014 11397-11397/? I/chromium: [INFO:CONSOLE(97)] "TypeError: Cannot call method 'substring' of undefined", source: file:///storage/emulated/0/Android/data/com.exiongames.exionoffroadracing/cache/UnityAdsCache/UnityAdsWebApp.html?platform=android&origin=https%3A%2F%2Fconfig.unityads.unity3d.com%2Fwebview%2F4.0.0%2Fd70a756f493f1244b592197df4d8602a835ccb0b%2Frelease%2Findex.html&version=d70a756f493f1244b592197df4d8602a835ccb0b (97)
    2022-06-15 11:33:16.194 11397-12027/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:1) :: Unity Ads event: sending midpoint event to https://publisher-event.unityads.un...35a1613b2100486be708-6089fdfd5f830b53cac1eabf
    2022-06-15 11:33:21.039 11397-11397/? I/chromium: [INFO:CONSOLE(97)] "TypeError: Cannot call method 'substring' of undefined", source: file:///storage/emulated/0/Android/data/com.exiongames.exionoffroadracing/cache/UnityAdsCache/UnityAdsWebApp.html?platform=android&origin=https%3A%2F%2Fconfig.unityads.unity3d.com%2Fwebview%2F4.0.0%2Fd70a756f493f1244b592197df4d8602a835ccb0b%2Frelease%2Findex.html&version=d70a756f493f1244b592197df4d8602a835ccb0b (97)
    2022-06-15 11:33:21.109 11397-12027/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:1) :: Unity Ads event: sending third_quartile event to https://publisher-event.unityads.un...35a1613b2100486be708-6089fdfd5f830b53cac1eabf
    2022-06-15 11:33:25.769 11397-11397/? I/chromium: [INFO:CONSOLE(97)] "TypeError: Cannot call method 'substring' of undefined", source: file:///storage/emulated/0/Android/data/com.exiongames.exionoffroadracing/cache/UnityAdsCache/UnityAdsWebApp.html?platform=android&origin=https%3A%2F%2Fconfig.unityads.unity3d.com%2Fwebview%2F4.0.0%2Fd70a756f493f1244b592197df4d8602a835ccb0b%2Frelease%2Findex.html&version=d70a756f493f1244b592197df4d8602a835ccb0b (97)
    2022-06-15 11:33:26.264 11397-11397/? I/chromium: [INFO:CONSOLE(97)] "TypeError: Cannot call method 'substring' of undefined", source: file:///storage/emulated/0/Android/data/com.exiongames.exionoffroadracing/cache/UnityAdsCache/UnityAdsWebApp.html?platform=android&origin=https%3A%2F%2Fconfig.unityads.unity3d.com%2Fwebview%2F4.0.0%2Fd70a756f493f1244b592197df4d8602a835ccb0b%2Frelease%2Findex.html&version=d70a756f493f1244b592197df4d8602a835ccb0b (97)
    2022-06-15 11:33:27.454 11397-12027/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:1) :: Unity Ads event: sending view event to https://publisher-event.unityads.un...35a1613b2100486be708-6089fdfd5f830b53cac1eabf
    2022-06-15 11:33:37.359 11397-12027/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:1) :: Closing Unity Ads ad unit
    2022-06-15 11:33:37.939 2433-2660/? I/WindowManager: Screen frozen for +733ms due to Window{432c3518 u0 com.game/com.unity3d.player.UnityPlayerActivity}
    2022-06-15 11:33:38.004 11397-11430/? I/Unity: UnityAdsAndroid.OnUnityAdsShowStartEvent: Android_Interstitial
    2022-06-15 11:33:38.004 11397-11430/? I/Unity: UnityAdsAndroid.OnUnityAdsShowCompleteEvent: Android_Interstitial
     
    Last edited: Jun 16, 2022
  8. xGeorgeV

    xGeorgeV

    Joined:
    Aug 8, 2013
    Posts:
    63
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.Advertisements;
    5.  
    6. public class UnityAdsAndroid : MonoBehaviour, IUnityAdsLoadListener, IUnityAdsShowListener
    7. {
    8.     // ===========================================================================
    9.     //                               UnityAdsAndroid
    10.     // ===========================================================================
    11.  
    12.     public void LoadInterstitialAd()
    13.     {
    14.         Advertisement.Load( "Android_Interstitial", this );
    15.         Debug.Log( "UnityAdsAndroid.LoadInterstitialAd()" );
    16.     }
    17.     public void LoadRewardBasedAd()
    18.     {
    19.         Advertisement.Load( "Android_Rewarded", this );
    20.         Debug.Log( "UnityAdsAndroid.LoadRewardBasedAd()" );
    21.     }
    22.     public void ShowInterstitialAd()
    23.     {
    24.         Advertisement.Show( "Android_Interstitial", this );
    25.         Debug.Log( "UnityAdsAndroid.ShowInterstitialAd()" );
    26.     }
    27.     public void ShowRewardBasedAd()
    28.     {
    29.         Advertisement.Show( "Android_Rewarded", this );
    30.         Debug.Log( "UnityAdsAndroid.ShowRewardBasedAd()" );
    31.     }
    32.  
    33.     // ===========================================================================
    34.     //                              InterstitialAd
    35.     // ===========================================================================
    36.     public void OnUnityAdsAdLoaded( string adUnitId )
    37.     {
    38.         Debug.Log( "UnityAdsAndroid.UnityAdsAdLoadedEvent: " + adUnitId );
    39.     }
    40.     public void OnUnityAdsFailedToLoad( string adUnitId, UnityAdsLoadError error, string message )
    41.     {
    42.         Debug.Log( $"Error loading Ad Unit: {adUnitId} - {error.ToString()} - {message}" );
    43.     }
    44.     public void OnUnityAdsShowFailure( string adUnitId, UnityAdsShowError error, string message )
    45.     {
    46.         Debug.Log( $"Error showing Ad Unit {adUnitId}: {error.ToString()} - {message}" );
    47.     }
    48.     public void OnUnityAdsShowStart( string adUnitId ) { Debug.Log( "UnityAdsAndroid.OnUnityAdsShowStartEvent: " + adUnitId ); }
    49.     public void OnUnityAdsShowClick( string adUnitId ) { Debug.Log( "UnityAdsAndroid.OnUnityAdsShowClickEvent: " + adUnitId ); }
    50.     public void OnUnityAdsShowComplete( string adUnitId, UnityAdsShowCompletionState showCompletionState ) { Debug.Log( "UnityAdsAndroid.OnUnityAdsShowCompleteEvent: " + adUnitId ); }
    51. }
     
    Last edited: Jun 15, 2022
    Navid-j likes this.
  9. xGeorgeV

    xGeorgeV

    Joined:
    Aug 8, 2013
    Posts:
    63
    Code (CSharp):
    1. using System;
    2. using System.Collections;
    3. using UnityEngine;
    4. using UnityEngine.Advertisements;
    5.  
    6. public class UnityAdsPluginScript : MonoBehaviour, IUnityAdsInitializationListener
    7. {
    8.     void Start()
    9.     {
    10.         if( !Advertisement.isInitialized ) { Advertisement.Initialize( sUnityAdsAndroidGameID, false, this ); }
    11.     }
    12.  
    13.     public void OnInitializationComplete()
    14.     {
    15.         ads.iUnityAdsAndroid.LoadInterstitialAd();
    16.     }
    17.  
    18.     public void OnInitializationFailed(UnityAdsInitializationError error, string message)
    19.     {
    20.         Debug.Log($"Unity Ads Initialization Failed: {error.ToString()} - {message}");
    21.     }
    22. }
    23.  
    24. //
    25. // Another file
    26. //
    27.  
    28. using UnityEngine;
    29.  
    30. public class ads
    31. {
    32.     public static UnityAdsAndroid iUnityAdsAndroid = new UnityAdsAndroid();
    33. }
    34.  
    35. //
    36. // Another file
    37. //
    38.  
    39. ads.iUnityAdsAndroid.ShowInterstitialAd();
     
    Navid-j likes this.
  10. xGeorgeV

    xGeorgeV

    Joined:
    Aug 8, 2013
    Posts:
    63
    This interface style eventhandler (callback) is a bad idea for ads, because in this case the advertisment class cannot be static.
    For example: "public static class UnityAdsAndroid".

    Advertisements are used in many different parts of the program, therefore it is better way to have a static advertisement class.

    The better way is to use the Advertisement.isReady() ( Advertisement.isInterstitialReady(), Advertisement.isRewardedReady(), ... ) instead of callbacks. Easy to use, fast integration, more stable operation, faster update, satisfied developers...
     
    Last edited: Jun 15, 2022
  11. SamOYUnity3D

    SamOYUnity3D

    Unity Technologies

    Joined:
    May 12, 2019
    Posts:
    597
  12. xGeorgeV

    xGeorgeV

    Joined:
    Aug 8, 2013
    Posts:
    63
    Just find this line in the log above...

    2022-06-15 11:32:47.054 11397-11430/? I/Unity: Error loading Ad Unit: Android_Interstitial - TIMEOUT - [UnityAds] Timeout while loading Android_Interstitial
     
  13. xGeorgeV

    xGeorgeV

    Joined:
    Aug 8, 2013
    Posts:
    63
    Same problem with Unity Ads 3.7.5. TIMEOUT.
     
  14. xGeorgeV

    xGeorgeV

    Joined:
    Aug 8, 2013
    Posts:
    63
    Event timing is unusable.

    ShowStart Event after Closing Unity Ads:

    2022-06-18 23:29:08.214 3625-3895/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:1) :: Closing Unity Ads ad unit
    2022-06-18 23:29:08.396 3625-3645/? I/Unity: UnityAdsAndroid.OnUnityAdsShowStartEvent: Android_Interstitial
    2022-06-18 23:29:08.396 3625-3645/? I/Unity: UnityAdsAndroid.OnUnityAdsShowCompleteEvent: Android_Interstitial