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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Bug Unity Ads 4.2.1 does not work

Discussion in 'Unity Ads & User Acquisition' started by xGeorgeV, Jul 7, 2022.

  1. xGeorgeV

    xGeorgeV

    Joined:
    Aug 8, 2013
    Posts:
    63
    Because the LoadListener always call the OnUnityAdsFailedToLoad, I imported and tested the Unity Ads 4.2.1 sample code (Package Manager > Advertisement > Samples > Import).

    The result:

    2022-07-07 18:27:01.636 18451-18483/? I/Unity: Android supported by Advertisement
    2022-07-07 18:27:01.696 18451-18483/? D/UnityAds: com.unity3d.services.core.misc.Utilities.writeFile() (line:9) :: Wrote file: /data/data/com.exiongames.exionhillracing/files/UnityAdsStorage-public-data.json
    2022-07-07 18:27:01.696 18451-18483/? D/UnityAds: com.unity3d.services.core.misc.Utilities.writeFile() (line:9) :: Wrote file: /data/data/com.exiongames.exionhillracing/files/UnityAdsStorage-private-data.json
    2022-07-07 18:27:01.696 18451-18483/? D/UnityAds: com.unity3d.services.core.misc.Utilities.writeFile() (line:9) :: Wrote file: /data/data/com.exiongames.exionhillracing/files/UnityAdsStorage-public-data.json
    2022-07-07 18:27:01.696 18451-18483/? D/UnityAds: com.unity3d.services.core.device.Storage.sendEvent() (line:3) :: Couldn't send storage event to WebApp
    2022-07-07 18:27:01.711 18451-18483/? D/UnityAds: com.unity3d.services.core.misc.Utilities.writeFile() (line:9) :: Wrote file: /data/data/com.exiongames.exionhillracing/files/UnityAdsStorage-public-data.json
    2022-07-07 18:27:01.711 18451-18483/? D/UnityAds: com.unity3d.services.core.device.Storage.sendEvent() (line:3) :: Couldn't send storage event to WebApp
    2022-07-07 18:27:01.716 18451-18483/? D/UnityAds: com.unity3d.services.ads.UnityAdsImplementation.initialize() (line:3) :: ENTERED METHOD
    2022-07-07 18:27:01.716 18451-18483/? D/UnityAds: com.unity3d.services.UnityServices.initialize() (line:1) :: ENTERED METHOD
    2022-07-07 18:27:01.736 18451-18483/? I/UnityAds: com.unity3d.services.UnityServices.initialize() (line:35) :: Initializing Unity Services 4.2.1 (4210) with game id 3003911 in production mode
    2022-07-07 18:27:01.756 18451-18483/? I/UnityAds: com.unity3d.services.UnityServices.initialize() (line:42) :: Unity Services environment check OK
    2022-07-07 18:27:01.811 18451-19193/? 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-07-07 18:27:02.436 18451-19193/? I/UnityAds: com.unity3d.services.core.configuration.InitializeThread$InitializeStateLoadWeb.execute() (line:1) :: Unity Ads init: loading webapp from https://config.unityads.unity3d.com...d883c72d73e4a5d50d449c787d/release/index.html
    2022-07-07 18:27:06.386 18451-18451/? I/chromium: [INFO:CONSOLE(7)] "Viewport argument key "viewport-fit" not recognized and ignored.", source: file:///storage/emulated/0/Android/data/com.exiongames.exionhillracing/cache/UnityAdsCache/UnityAdsWebApp.html?platform=android&origin=https%3A%2F%2Fconfig.unityads.unity3d.com%2Fwebview%2F4.0.0%2F3d7456a0f5f602d883c72d73e4a5d50d449c787d%2Frelease%2Findex.html&version=3d7456a0f5f602d883c72d73e4a5d50d449c787d (7)
    2022-07-07 18:27:09.986 18451-19264/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:1) :: Requesting configuration from https://publisher-config.unityads.u...r=[object Object]&userLevelFlagDetected=false
    2022-07-07 18:27:10.516 18451-19264/? E/UnityAds: com.unity3d.services.core.api.Sdk.logError() (line:1) :: Game Configuration Request Failed: {"message":"FAILED_WITH_ERROR_RESPONSE","nativeRequest":{"method":0,"url":"https://publisher-config.unityads.u...r=[object Object]&userLevelFlagDetected=false","headers":[],"retryCount":0,"options":{"retries":2,"retryDelay":10000,"followRedirects":false,"retryWithConnectionEvents":true}},"nativeResponse":{"url":"https://publisher-config.unityads.u...r=[object Object]&userLevelFlagDetected=false","response":"{\"error\":\"request conflicts with the configuration - mismatched platform\"}\n","responseCode":409,"headers":[["X-Android-Selected-Transport","http/1.1"],["Alt-Svc","h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000"],["Access-Control-Allow-Origin","*"],["Transfer-Encoding","chunked"],["Vary","Accept-Encoding"],["Date","Thu, 07 Jul 2022 16:27:10 GMT"],["X-Android-Received-Millis","1657211230503"],["Via","1.1 google"],["X-Origlength","75"],["Content-Type","application/json"],["X-Service","ads-sdk-configuration"],["X-Android-Response-Source","NETWORK 409"],["X-Android-Sent-Millis","1657211230345"]]}}
    2022-07-07 18:27:10.531 18451-19193/? E/UnityAds: com.unity3d.services.core.configuration.InitializeThread$InitializeStateCreate.execute() (line:8) :: Unity Ads SDK fail to initialize due to configuration error
    2022-07-07 18:27:10.531 18451-19264/? E/UnityAds: com.unity3d.services.core.api.Sdk.logError() (line:1) :: Initialization error: Unity Ads SDK fail to initialize due to configuration error
    2022-07-07 18:27:10.531 18451-19193/? E/UnityAds: com.unity3d.services.core.configuration.InitializeThread$InitializeStateError.execute() (line:1) :: Unity Ads init: halting init in create webapp: Unity Ads SDK fail to initialize due to configuration error
    2022-07-07 18:27:10.531 18451-19193/? E/UnityAds: com.unity3d.services.core.configuration.InitializationNotificationCenter.triggerOnSdkInitializationFailed() (line:3) :: SDK Failed to Initialize due to Unity Ads SDK fail to initialize due to configuration error
    2022-07-07 18:27:10.576 18451-18483/? I/Unity: Init Failed: [INTERNAL_ERROR]: Unity Ads SDK fail to initialize due to configuration error
    2022-07-07 18:27:32.426 18451-18483/? I/Unity: Load Failed: [INITIALIZE_FAILED:video] [UnityAds] SDK Initialization Failed
    2022-07-07 18:27:41.456 18451-18483/? I/Unity: OnUnityAdsShowFailure: [NOT_INITIALIZED]: Unity Ads is not initialized

     
  2. Unity_Adamski

    Unity_Adamski

    Unity Technologies

    Joined:
    Jul 20, 2020
    Posts:
    110
    Hi,

    Looking at the logs you have shared I can see that you are trying to use the Game ID 3003911. However, this Game ID is an iOS Game ID and as such is causing a mismatched platform error. To avoid this error you will need to use the Android Game ID.
     
  3. xGeorgeV

    xGeorgeV

    Joined:
    Aug 8, 2013
    Posts:
    63
    Ok. I changed the GameID to Android...
    This is the Unity Ads 4.2.1 sample code (Package Manager > Advertisement > Samples > Import).

    The result:

    Init: OK.

    Load Ad: OnUnityAdsFailedToLoad: TIMEOUT [Always!] [But Ad has loaded!]
    I can't check if the ad has already been loaded.
    "Smart" people removed the Advertisement.isReady() function from Unity Ads. Why? The OnUnityAdsAdLoaded event DOES NOT WORK!

    Show Ad: Show the Ad. OnUnityAdsShowStart event and OnUnityAdsShowComplete event called at the same time: When Ad Closed.

    The LOG file:

    2022-07-08 17:47:03.139 17366-17388/? I/Unity: Android supported by Advertisement
    2022-07-08 17:47:03.204 17366-17388/? D/UnityAds: com.unity3d.services.core.misc.Utilities.writeFile() (line:9) :: Wrote file: /data/data/com.exiongames.exionhillracing/files/UnityAdsStorage-public-data.json
    2022-07-08 17:47:03.204 17366-17388/? D/UnityAds: com.unity3d.services.core.device.Storage.sendEvent() (line:3) :: Couldn't send storage event to WebApp
    2022-07-08 17:47:03.209 17366-17388/? D/UnityAds: com.unity3d.services.core.misc.Utilities.writeFile() (line:9) :: Wrote file: /data/data/com.exiongames.exionhillracing/files/UnityAdsStorage-public-data.json
    2022-07-08 17:47:03.209 17366-17388/? D/UnityAds: com.unity3d.services.core.device.Storage.sendEvent() (line:3) :: Couldn't send storage event to WebApp
    2022-07-08 17:47:03.214 17366-17388/? D/UnityAds: com.unity3d.services.ads.UnityAdsImplementation.initialize() (line:3) :: ENTERED METHOD
    2022-07-08 17:47:03.214 17366-17388/? D/UnityAds: com.unity3d.services.UnityServices.initialize() (line:1) :: ENTERED METHOD
    2022-07-08 17:47:03.219 17366-17388/? I/UnityAds: com.unity3d.services.UnityServices.initialize() (line:35) :: Initializing Unity Services 4.2.1 (4210) with game id 1062440 in production mode
    2022-07-08 17:47:03.239 17366-17388/? I/UnityAds: com.unity3d.services.UnityServices.initialize() (line:42) :: Unity Services environment check OK
    2022-07-08 17:47:03.309 17366-18004/? 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-07-08 17:47:04.044 17366-18004/? I/UnityAds: com.unity3d.services.core.configuration.InitializeThread$InitializeStateLoadCache.execute() (line:6) :: Unity Ads init: webapp loaded from local cache
    2022-07-08 17:47:05.669 17366-17366/? I/chromium: [INFO:CONSOLE(7)] "Viewport argument key "viewport-fit" not recognized and ignored.", source: file:///storage/emulated/0/Android/data/com.exiongames.exionhillracing/cache/UnityAdsCache/UnityAdsWebApp.html?platform=android&origin=https%3A%2F%2Fconfig.unityads.unity3d.com%2Fwebview%2F4.0.0%2Fdb2d6052eba6879528954c033ae436e940584bda%2Frelease%2Findex.html&version=db2d6052eba6879528954c033ae436e940584bda (7)
    2022-07-08 17:47:08.939 17366-18050/? W/UnityAds: com.unity3d.services.core.api.Sdk.logWarning() (line:1) :: {"message":"model: DeviceInfo key: openAdvertisingTrackingId with value: null: null is not in: string,undefined","name":"CheckValueError"}
    2022-07-08 17:47:09.359 17366-18050/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:1) :: Requesting configuration from https://publisher-config.unityads.u...r=[object Object]&userLevelFlagDetected=false
    2022-07-08 17:47:09.919 17366-18050/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:1) :: Received configuration for token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhZyI6Iml6OVcrU3FGdjNLbEI1d3J5MkJHMGtQVjF1Wkl6V0hCTi9hbUxZT0hqaG5Ub0JFQ01FQ2tDbGZoMnNzMXh2ZEV4N3piN2c9PSIsImFwcCI6MTU5LCJhcHBMZXZlbENvcHBhIjpmYWxzZSwiYXR0IjowLCJhdWMiOjE0MCwiYXVpIjowLCJhenAiOiJlZGRmYjg5NC0xY2YwLTQ2YmQtOWY1Zi00ODA4MTkxNzk0NGUiLCJjYWxjdWxhdGVkQ29wcGEiOmZhbHNlLCJjb25zZW50Ijp0cnVlLCJjb250ZXh0dWFsT25seSI6ZmFsc2UsImNwaSI6OTcsImNyZWF0ZWQiOjE0NTgwNjE4MjUwMDAsImRsdCI6MCwiZHQiOjAsImV0dCI6WzIxNDc0ODM4MzcsNTk1NCw1OTYzLDU5NDEsNTQzMCw1MzQ5LDUzNDUsNTc1Nl0sImV4cCI6MTY1ODUwNDgzMCwiaWFwIjoxNjgsImlhdCI6MTY1NzI5NTIzMCwiaWciOiIvcUVnN3B3Y0x0MURvbWRhR0pXbFQ3Mmx1dW4xY1I0RlEydzI5WERJVFNpYXlYNkhZNGhLQXdxV0sxRnN4N1FWdjNNQzB3PT0iLCJpbnN0YWxsYXRpb25JZCI6ImUzZTk0ODU0N2Q5Yjk0YmUwYmRhOGUwODg1NDhjYWY3IiwiaXNzIjoiYWRzLXNkay1jb25maWd1cmF0aW9uLnVuaXR5YWRzLnVuaXR5M2QuY29tIiwibGVnYWxUZXJyaXRvcnkiOjEsImx0diI6OTUsIm1peGVkIjpmYWxzZSwicHJvIjoyNDEsInByb3hpZWQiOmZhbHNlLCJzdWIiOiJadXppMVZXUTdrdTIxdmtMT1p2MERwTlhSYi82ajFIU1RnTTBGOXBPMytmQXdCTHN5ZFluWVAzUGRYR2l2K2hTdUR5KzN3PT0iLCJ0Z3QiOjAsInhwciI6MjA4fQ.oSDqRcs-bOLpQ-joT8kSTVO9L9Ol1S3iqOOkER_8A18 (A/B group 2)
    2022-07-08 17:47:10.369 17366-17388/? I/Unity: Init Success
    2022-07-08 17:47:15.894 17366-18050/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:1) :: Requesting ad plan from https://auction.unityads.unity3d.co...Height=1280&connectionType=wifi&networkType=0
    2022-07-08 17:47:19.919 17366-18050/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:1) :: Webview started using the latest version
    2022-07-08 17:47:44.984 17366-17388/? I/Unity: Load Failed: [TIMEOUT:video] [UnityAds] Timeout while loading video
    2022-07-08 17:47:56.579 17366-18050/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:1) :: Opening performance ad unit with orientation PORTRAIT, hardware acceleration enabled
    2022-07-08 17:47:57.044 17366-17366/? I/chromium: [INFO:CONSOLE(97)] "TypeError: Cannot call method 'substring' of undefined", source: file:///storage/emulated/0/Android/data/com.exiongames.exionhillracing/cache/UnityAdsCache/UnityAdsWebApp.html?platform=android&origin=https%3A%2F%2Fconfig.unityads.unity3d.com%2Fwebview%2F4.0.0%2Fdb2d6052eba6879528954c033ae436e940584bda%2Frelease%2Findex.html&version=db2d6052eba6879528954c033ae436e940584bda (97)
    2022-07-08 17:47:58.779 17366-17366/? I/chromium: [INFO:CONSOLE(97)] "TypeError: Cannot call method 'substring' of undefined", source: file:///storage/emulated/0/Android/data/com.exiongames.exionhillracing/cache/UnityAdsCache/UnityAdsWebApp.html?platform=android&origin=https%3A%2F%2Fconfig.unityads.unity3d.com%2Fwebview%2F4.0.0%2Fdb2d6052eba6879528954c033ae436e940584bda%2Frelease%2Findex.html&version=db2d6052eba6879528954c033ae436e940584bda (97)
    2022-07-08 17:48:01.304 17366-17366/? I/chromium: [INFO:CONSOLE(97)] "TypeError: Cannot call method 'substring' of undefined", source: file:///storage/emulated/0/Android/data/com.exiongames.exionhillracing/cache/UnityAdsCache/UnityAdsWebApp.html?platform=android&origin=https%3A%2F%2Fconfig.unityads.unity3d.com%2Fwebview%2F4.0.0%2Fdb2d6052eba6879528954c033ae436e940584bda%2Frelease%2Findex.html&version=db2d6052eba6879528954c033ae436e940584bda (97)
    2022-07-08 17:48:01.494 17366-18050/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:1) :: Unity Ads event: sending start event to https://publisher-event.unityads.un...756d2e6337ece69f3d1d-622998f681480c666bba6257
    2022-07-08 17:48:07.374 17366-18050/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:1) :: Requesting ad plan from https://auction.unityads.unity3d.co...Height=1280&connectionType=wifi&networkType=0
    2022-07-08 17:48:08.594 17366-17366/? I/chromium: [INFO:CONSOLE(97)] "TypeError: Cannot call method 'substring' of undefined", source: file:///storage/emulated/0/Android/data/com.exiongames.exionhillracing/cache/UnityAdsCache/UnityAdsWebApp.html?platform=android&origin=https%3A%2F%2Fconfig.unityads.unity3d.com%2Fwebview%2F4.0.0%2Fdb2d6052eba6879528954c033ae436e940584bda%2Frelease%2Findex.html&version=db2d6052eba6879528954c033ae436e940584bda (97)
    2022-07-08 17:48:08.664 17366-18050/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:1) :: Unity Ads event: sending first_quartile event to https://publisher-event.unityads.un...756d2e6337ece69f3d1d-622998f681480c666bba6257
    2022-07-08 17:48:16.129 17366-17366/? I/chromium: [INFO:CONSOLE(97)] "TypeError: Cannot call method 'substring' of undefined", source: file:///storage/emulated/0/Android/data/com.exiongames.exionhillracing/cache/UnityAdsCache/UnityAdsWebApp.html?platform=android&origin=https%3A%2F%2Fconfig.unityads.unity3d.com%2Fwebview%2F4.0.0%2Fdb2d6052eba6879528954c033ae436e940584bda%2Frelease%2Findex.html&version=db2d6052eba6879528954c033ae436e940584bda (97)
    2022-07-08 17:48:16.224 17366-18050/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:1) :: Unity Ads event: sending midpoint event to https://publisher-event.unityads.un...756d2e6337ece69f3d1d-622998f681480c666bba6257
    2022-07-08 17:48:23.614 17366-17366/? I/chromium: [INFO:CONSOLE(97)] "TypeError: Cannot call method 'substring' of undefined", source: file:///storage/emulated/0/Android/data/com.exiongames.exionhillracing/cache/UnityAdsCache/UnityAdsWebApp.html?platform=android&origin=https%3A%2F%2Fconfig.unityads.unity3d.com%2Fwebview%2F4.0.0%2Fdb2d6052eba6879528954c033ae436e940584bda%2Frelease%2Findex.html&version=db2d6052eba6879528954c033ae436e940584bda (97)
    2022-07-08 17:48:23.744 17366-18050/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:1) :: Unity Ads event: sending third_quartile event to https://publisher-event.unityads.un...756d2e6337ece69f3d1d-622998f681480c666bba6257
    2022-07-08 17:48:30.979 17366-17366/? I/chromium: [INFO:CONSOLE(97)] "TypeError: Cannot call method 'substring' of undefined", source: file:///storage/emulated/0/Android/data/com.exiongames.exionhillracing/cache/UnityAdsCache/UnityAdsWebApp.html?platform=android&origin=https%3A%2F%2Fconfig.unityads.unity3d.com%2Fwebview%2F4.0.0%2Fdb2d6052eba6879528954c033ae436e940584bda%2Frelease%2Findex.html&version=db2d6052eba6879528954c033ae436e940584bda (97)
    2022-07-08 17:48:31.174 17366-17366/? I/chromium: [INFO:CONSOLE(97)] "TypeError: Cannot call method 'substring' of undefined", source: file:///storage/emulated/0/Android/data/com.exiongames.exionhillracing/cache/UnityAdsCache/UnityAdsWebApp.html?platform=android&origin=https%3A%2F%2Fconfig.unityads.unity3d.com%2Fwebview%2F4.0.0%2Fdb2d6052eba6879528954c033ae436e940584bda%2Frelease%2Findex.html&version=db2d6052eba6879528954c033ae436e940584bda (97)
    2022-07-08 17:48:31.714 17366-18050/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:1) :: Unity Ads event: sending view event to https://publisher-event.unityads.un...756d2e6337ece69f3d1d-622998f681480c666bba6257
    2022-07-08 17:48:39.589 17366-18050/? I/UnityAds: com.unity3d.services.core.api.Sdk.logInfo() (line:1) :: Closing Unity Ads ad unit
    2022-07-08 17:48:39.934 17366-17388/? I/Unity: OnUnityAdsShowStart: video
    2022-07-08 17:48:39.939 17366-17388/? I/Unity: OnUnityAdsShowComplete: [COMPLETED]: video
     
  4. berukulama

    berukulama

    Joined:
    Jun 27, 2020
    Posts:
    43
    None of my mobile games using Unity Ads 4.2.1 SDK show interstitials in the United States. In other countries there is no problem.
     
  5. xGeorgeV

    xGeorgeV

    Joined:
    Aug 8, 2013
    Posts:
    63
    It's lucky the world is big...
     
  6. berukulama

    berukulama

    Joined:
    Jun 27, 2020
    Posts:
    43
    I am experiencing a dramatic drop in income. Unfortunately, Unity support still did not respond to the ticket I opened. :(
     
  7. umarkhaleeq

    umarkhaleeq

    Joined:
    Dec 16, 2018
    Posts:
    6
    Same here... Release which use unity ads 4.1.0 (upgraded from 3.7.5) is showing only test ads to everyone.

    And revenue has come down to zero.

    Note: I already checked my script and implementation and everything is ok there.
     
  8. xGeorgeV

    xGeorgeV

    Joined:
    Aug 8, 2013
    Posts:
    63
    Unfortunately, this is the period of decreasing revenues in all advertising systems.
    Unity's customer service is ... ahhh...
     
  9. xGeorgeV

    xGeorgeV

    Joined:
    Aug 8, 2013
    Posts:
    63
    Unity Ads is under integration with ironSource, I think this period will be problematic...
     
  10. berukulama

    berukulama

    Joined:
    Jun 27, 2020
    Posts:
    43
    I wish they had informed us that there would be disruptions in this regard.
     
  11. eddyjohnson3

    eddyjohnson3

    Joined:
    Jul 27, 2012
    Posts:
    49
    I'm getting ready to update to >4.0.1 to comply with google play, so this is kind of concerning to read. Is there any version that is stable and working or do all versions after 4.0 are equally buggy?
     
  12. berukulama

    berukulama

    Joined:
    Jun 27, 2020
    Posts:
    43
    I haven't been able to generate revenue from the United States for almost a week on any of my games above version 4, and that's a big problem for me. I suggest you wait until the problem is resolved.
     
  13. berukulama

    berukulama

    Joined:
    Jun 27, 2020
    Posts:
    43
    the problem still persists for me. If my problem is solved, I will let you know here. :(
     
  14. eddyjohnson3

    eddyjohnson3

    Joined:
    Jul 27, 2012
    Posts:
    49
    Did you get an answer from support?
     
  15. berukulama

    berukulama

    Joined:
    Jun 27, 2020
    Posts:
    43
    yes i am getting help from support and i am still waiting. I've updated Unity Ads 4.2.1 in more than 30 of my games, and the loss of income I experienced put me in a serious depression.
     
  16. dwilden

    dwilden

    Joined:
    Mar 29, 2021
    Posts:
    20
    I had same problem a few months ago when I first published a game on Google using SDK 4.0.1. I got round it by downgrading to SDK 3.7.5.

    Although I got help from Unity support in testing my fixed release in the US, I never got an explanation as to why the problerm only seems to to affect the US users. Doesn't this imply something wrong with the US server configuration? Possibly a timing issue??? If so wouldn't a better solution be to fix the problem with the servers?

    Could Unity Support please post something to explain what is being done to investigate or work round the problem, as lots of us are now having to face the prospect of moving to the problermatic version in the next few weeks n order to comply with Google's new policy.
     
  17. xGeorgeV

    xGeorgeV

    Joined:
    Aug 8, 2013
    Posts:
    63
    The Unity Ads 4.2.1 sample code (Package Manager > Advertisement > Samples > Import) DOES NOT WORK!

    Unity: Init Success
    Unity: Load Failed: [TIMEOUT:video] [UnityAds] Timeout while loading video

    This is a total disaster...

     
  18. berukulama

    berukulama

    Joined:
    Jun 27, 2020
    Posts:
    43
    I contacted Unity support and we found a solution based on my codes. Now 4.2.1 is working correctly. If the ad request ad and ad display codes are in the same scene, there is no problem. but it doesn't work if you call codes in another scene. It is necessary to load and run the ad separately for each scene. it's working perfectly now.
     
    dwilden, ScottAdams and Jmonroe like this.
  19. dwilden

    dwilden

    Joined:
    Mar 29, 2021
    Posts:
    20
     
  20. xGeorgeV

    xGeorgeV

    Joined:
    Aug 8, 2013
    Posts:
    63
    This is a joke... Have you heard of "public static class" at Unity? ALL other advertisement system uses it...
     
  21. berukulama

    berukulama

    Joined:
    Jun 27, 2020
    Posts:
    43
    Unfortunately, you cannot use the ad you called in another scene in another scene. you should create a call for each scene and for each ad type. This is how I solved it. If you're still having problems, I suggest you try this solution.
     
  22. xGeorgeV

    xGeorgeV

    Joined:
    Aug 8, 2013
    Posts:
    63
    My solution (with Unity Ads 4.2.1) is working with multiple scene under Android 10, and this is working with Android 4.4 but in this case (Android 4.4) only the event system is not working, because I alway get the "Unity: Load Failed: [TIMEOUT:video] [UnityAds] Timeout while loading video" error event only.

    My solution... Unfortunately the UnityAdsAndroid class can not be static...

    Somewhere when program start:

    ----------------------
    LoadingScript.cs
    ----------------------

    public class ads
    {
    public static UnityAdsAndroid iUnityAdsAndroid = new UnityAdsAndroid();
    }

    --------------------------
    UnityAdsAndroid.cs
    --------------------------

    public class UnityAdsAndroid : MonoBehaviour, IUnityAdsLoadListener, IUnityAdsShowListener
    {
    public void LoadInterstitialAd()
    {
    Advertisement.Load( "Android_Interstitial", this );
    }
    public void ShowInterstitialAd()
    {
    Advertisement.Show( "Android_Interstitial", this );
    }

    public void OnUnityAdsAdLoaded( string adUnitId )
    {
    // This is not working under Anroid 4.4
    }
    public void OnUnityAdsFailedToLoad( string adUnitId, UnityAdsLoadError error, string message )
    {
    Debug.Log( $"Error loading Ad Unit: {adUnitId} - {error.ToString()} - {message}" );
    }
    public void OnUnityAdsShowFailure( string adUnitId, UnityAdsShowError error, string message )
    {
    Debug.Log( $"Error showing Ad Unit {adUnitId}: {error.ToString()} - {message}" );
    }
    }

    ---------------------------------------------
    You can use it with multiple scene:
    ---------------------------------------------
    . . .
    ads.iUnityAdsAndroid.LoadInterstitialAd();
    . . .

    . . .
    ads.iUnityAdsAndroid.ShowInterstitialAd();
    . . .
     
    Last edited: Jul 26, 2022
  23. charith11

    charith11

    Joined:
    Sep 29, 2017
    Posts:
    23
    same problem here. i checked the android logcat and it say
    "Error Unity Exception: No such proxy method: UnityEngine.Advertisements.AndroidLoadListener.onUnityAdsFailedToLoad(System.String)"
    any proper answer from unity?
     
  24. charith11

    charith11

    Joined:
    Sep 29, 2017
    Posts:
    23
    Can you explain your solution clearly? I didn't get it.
     
  25. berukulama

    berukulama

    Joined:
    Jun 27, 2020
    Posts:
    43
    create an admanager object. Add Ad instalize to it and the code for the ad type you want. In addition to these codes, ensure that the admanager object is triggered when you want the ad to appear. Did you overcome the problem?
     
  26. berukulama

    berukulama

    Joined:
    Jun 27, 2020
    Posts:
    43
    [SerializeField] string _androidGameId;
    [SerializeField] string _iOSGameId;
    [SerializeField] bool _testMode = true;
    private string _gameId;
    public InterstitialAd interstitialAd;

    void Awake()
    {
    InitializeAds();
    }

    public void InitializeAds()
    {
    _gameId = (Application.platform == RuntimePlatform.IPhonePlayer)
    ? _iOSGameId
    : _androidGameId;
    Advertisement.Initialize(_gameId, _testMode, this);
    }

    public void OnInitializationComplete()
    {
    Debug.Log("Unity Ads initialization complete.");
    interstitialAd.LoadAd();
    }

    public void OnInitializationFailed(UnityAdsInitializationError error, string message)
    {
    Debug.Log($"Unity Ads Initialization Failed: {error.ToString()} - {message}");
    }
    }

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.Advertisements;
    public class InterstitialAd : MonoBehaviour, IUnityAdsLoadListener, IUnityAdsShowListener
    {
    [SerializeField] string _androidAdUnitId = "Interstitial_Android";
    [SerializeField] string _iOsAdUnitId = "Interstitial_iOS";
    string _adUnitId;
    void Awake()
    {
    // Get the Ad Unit ID for the current platform:
    _adUnitId = (Application.platform == RuntimePlatform.IPhonePlayer)
    ? _iOsAdUnitId
    : _androidAdUnitId;
    }
    // Load content to the Ad Unit:
    public void LoadAd()
    {
    // IMPORTANT! Only load content AFTER initialization (in this example, initialization is handled in a different script).
    Debug.Log("Loading Ad: " + _adUnitId);
    Advertisement.Load(_adUnitId, this);
    }
    // Show the loaded content in the Ad Unit:
    public void ShowAd()
    {
    // Note that if the ad content wasn't previously loaded, this method will fail
    Debug.Log("Showing Ad: " + _adUnitId);
    Advertisement.Show(_adUnitId, this);
    }
    // Implement Load Listener and Show Listener interface methods:
    public void OnUnityAdsAdLoaded(string adUnitId)
    {
    // Optionally execute code if the Ad Unit successfully loads content.
    }
    public void OnUnityAdsFailedToLoad(string adUnitId, UnityAdsLoadError error, string message)
    {
    Debug.Log($"Error loading Ad Unit: {adUnitId} - {error.ToString()} - {message}");
    // Optionally execute code if the Ad Unit fails to load, such as attempting to try again.
    }
    public void OnUnityAdsShowFailure(string adUnitId, UnityAdsShowError error, string message)
    {
    Debug.Log($"Error showing Ad Unit {adUnitId}: {error.ToString()} - {message}");
    // Optionally execute code if the Ad Unit fails to show, such as loading another ad.
    }
    public void OnUnityAdsShowStart(string adUnitId) { }
    public void OnUnityAdsShowClick(string adUnitId) { }
    public void OnUnityAdsShowComplete(string adUnitId, UnityAdsShowCompletionState showCompletionState) { LoadAd(); }
    }

    public class UnityAds : MonoBehaviour
    {


    public InterstitialAd adloader;



    // Start is called before the first frame update
    void Start()
    {


    StartCoroutine(WaitCourutine());


    }
    IEnumerator WaitCourutine()
    {
    yield return new WaitForSeconds(5);
    adloader.ShowAd();
    }
     
    charith11 likes this.
  27. charith11

    charith11

    Joined:
    Sep 29, 2017
    Posts:
    23
    Thank you for your support. you mean that we should run separate three classes for Banner, Interstitial and reward? I put all Ad function in one script. adManager gameObject is in "don't destroy on load". Ads are working only in Editor only not in real device. I didn't overcome this issue yet.
     
  28. charith11

    charith11

    Joined:
    Sep 29, 2017
    Posts:
    23
    My AdScript is:

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.Advertisements;
    using UnityEngine.SceneManagement;

    public class AdController2 : MonoBehaviour, IUnityAdsInitializationListener, IUnityAdsLoadListener, IUnityAdsShowListener
    {
    public static AdController2 instance;

    private string store_id = "xxxxxx";
    [SerializeField] bool _testMode = true;

    private string video_ad = "video";
    private string rewarded_video_ad = "rewardedVideo";
    private string rewardedVideo2 = "RewardedVideo2";
    private string rewardedVideo3 = "RewardedVideo3";

    private void Awake()
    {
    if(Advertisement.isInitialized)
    {
    Debug.Log("Advertisement is initialized.");

    } else
    {
    InitializeAds();
    }

    if (instance != null)
    {
    Destroy(gameObject);
    }
    else
    {
    instance = this;
    DontDestroyOnLoad(gameObject);
    }
    }

    void Start()
    {

    }

    void Update()
    {

    }

    public void InitializeAds()
    {
    Advertisement.Initialize(store_id, _testMode, this);
    }

    public void OnInitializationComplete()
    {
    Debug.Log("Unity Ads initialization complete.");

    }

    public void OnInitializationFailed(UnityAdsInitializationError error, string message)
    {
    Debug.Log($"Unity Ads Initialization Failed: {error.ToString()} - {message}");
    }

    public void LoadVideoAd()
    {
    Advertisement.Load(video_ad, this);
    }

    public void LoadRewardedAd()
    {
    Advertisement.Load(rewarded_video_ad, this);
    }

    public void LoadRewardedAd2()
    {
    Advertisement.Load(rewardedVideo2, this);
    }

    public void LoadRewardedAd3()
    {
    Advertisement.Load(rewardedVideo3, this);
    }

    public void OnUnityAdsAdLoaded(string adUnitId)
    {
    Advertisement.Show(adUnitId, this);
    }

    public void OnUnityAdsFailedToLoad(string adUnitId, UnityAdsLoadError error, string message)
    {
    Debug.Log($"Error loading Ad Unit: {adUnitId} - {error.ToString()} - {message}");
    Advertisement.Load(adUnitId, this);
    }

    public void OnUnityAdsShowFailure(string adUnitId, UnityAdsShowError error, string message)
    {
    Debug.Log("OnUnityAdsShowFailure");
    Advertisement.Load(adUnitId, this);
    }

    public void OnUnityAdsShowStart(string adUnitId)
    {
    Debug.Log("OnUnityAdsShowStart");
    }

    public void OnUnityAdsShowClick(string adUnitId)
    {
    Debug.Log("OnUnityAdsShowClick");
    }

    public void OnUnityAdsShowComplete(string adUnitId, UnityAdsShowCompletionState showCompletionState)
    {
    Debug.Log("OnUnityAdsShowComplete" + showCompletionState);
    if(adUnitId.Equals(rewarded_video_ad) && UnityAdsShowCompletionState.COMPLETED.Equals(showCompletionState))
    {
    GamePlayController.instance.b--;
    GamePlayController.instance.continueWithWatchVideoPanel.gameObject.SetActive(false);
    GamePlayController.instance.watchedVideo = true;
    GamePlayController.instance.chansesBallLeft = 3; //GamePlayController.instance.chansesBallLeft + 3;
    GamePlayController.instance.totalBallLandedLeft = 4; //GamePlayController.instance.totalBallLandedLeft + 4;
    }
    if (adUnitId.Equals(rewardedVideo2) && UnityAdsShowCompletionState.COMPLETED.Equals(showCompletionState))
    {
    BallMenuController.instance.isVidzReady = false;
    BallMenuController.instance.ResetTimer();
    BallMenuController.instance.vidz[BallMenuController.instance.vidzIntt]--;
    BallMenuController.instance.vidzIntText[BallMenuController.instance.vidzIntt].text = "" + BallMenuController.instance.vidz[BallMenuController.instance.vidzIntt];

    if (BallMenuController.instance.vidz[BallMenuController.instance.vidzIntt] == 0)
    {
    if (GameController.instance.isSoundOn)
    {
    MusicController.instance.StopSpecPowerUp3Sound();
    MusicController.instance.PlaySpecPowerUp3Sound();
    }

    BallMenuController.instance.balls[BallMenuController.instance.selectedBalll] = true;
    BallMenuController.instance.lockImages[BallMenuController.instance.selectedBalll].gameObject.SetActive(false);
    BallMenuController.instance.extraBallActivatedPanel.gameObject.SetActive(true);
    BallMenuController.instance.extraBallThatActivated.sprite = BallMenuController.instance.choosedFruitBallSprite[BallMenuController.instance.selectedBalll];
    BallMenuController.instance.unlockedBallName.text = "" + BallMenuController.instance.ballNamee;
    BallMenuController.instance.vidzIntText[BallMenuController.instance.vidzIntt].gameObject.SetActive(false);

    GameController.instance.vidz = BallMenuController.instance.vidz;
    GameController.instance.balls = BallMenuController.instance.balls;
    GameController.instance.Qbody = BallMenuController.instance.Qbody;
    GameController.instance.isVidzReady = BallMenuController.instance.isVidzReady;
    GameController.instance.Save();

    BallMenuController.instance.FruitBall(BallMenuController.instance.selectedBalll, BallMenuController.instance.ballNamee);
    }
    else
    {
    GameController.instance.vidz = BallMenuController.instance.vidz;
    GameController.instance.isVidzReady = BallMenuController.instance.isVidzReady;
    GameController.instance.Save();
    }
    }
    if (adUnitId.Equals(rewardedVideo3) && UnityAdsShowCompletionState.COMPLETED.Equals(showCompletionState))
    {
    TimeController2.instance.SaveDate();
    MainMenuController.instance.timer2 = 480;
    MainMenuController.instance.timer2 -= TimeController2.instance.CheckDate();

    MainMenuController.instance.isVidzReady2 = false;
    GameController.instance.isVidzReady2 = MainMenuController.instance.isVidzReady2;
    GameController.instance.Save();

    SceneManager.LoadScene("VideoAwardScene");
    }

    }
    }
     
  29. berukulama

    berukulama

    Joined:
    Jun 27, 2020
    Posts:
    43
    Try the codes I applied, it will definitely work. I'm just running an interstitial. If you try these codes with this method, I think you will get results. I think if you create a manager object for each ad and put it on the scenes as prefab, they will all work.
     
    charith11 likes this.
  30. charith11

    charith11

    Joined:
    Sep 29, 2017
    Posts:
    23
    Thank You berukulama. I will do it and will tell the result.
     
    berukulama likes this.
  31. berukulama

    berukulama

    Joined:
    Jun 27, 2020
    Posts:
    43
    Is the problem solved?
     
    charith11 likes this.
  32. charith11

    charith11

    Joined:
    Sep 29, 2017
    Posts:
    23
    Finally I found the solution. Avast antivirus was blocking ad requests internally. Code was totally correct. Thank you in advance for your help.
     
    berukulama likes this.
  33. xGeorgeV

    xGeorgeV

    Joined:
    Aug 8, 2013
    Posts:
    63
    Unity Ads 4.3.0 WORKS!
    The OnUnityAdsAdLoaded event works with Andoroid 4.4 also!

    OnUnityAdsShowStart event and OnUnityAdsShowComplete event called at the same time: When Ad Closed. There is no problem. :)
     
  34. RSH1

    RSH1

    Joined:
    Jul 9, 2012
    Posts:
    250
    Ads shown outside the US generate a fraction of the revenue.