Search Unity

Bug Unity Ads Not Working

Discussion in 'Unity Ads & User Acquisition' started by ByRR, Feb 28, 2023.

  1. ByRR

    ByRR

    Joined:
    Jan 11, 2023
    Posts:
    3
    Hello. Im using Unity 2021.3.16f1 editor. And im using Unity Ads sdk 4.4.1. Im created 2 game and added Unity Ads in the game. And all ads working very well in the editor but not working in the phone. Im published my games on the Play Store. And im checked logcat logs and saw the my ads not initizialing.

    Im shared below my logcat logs and my script code.

    Please help me about that.



    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.Advertisements;
    3.  
    4. public class UnityAdsInitializer : MonoBehaviour, IUnityAdsInitializationListener
    5. {
    6.     [SerializeField] string _androidGameId = "myandroidid";
    7.     [SerializeField] string _iOSGameId = "myiosid";
    8.     [SerializeField] bool _testMode = false;
    9.     private string _gameId;
    10.  
    11.     void Awake()
    12.     {
    13.         InitializeAds();
    14.     }
    15.  
    16.     public void InitializeAds()
    17.     {
    18.         _gameId = (Application.platform == RuntimePlatform.IPhonePlayer)
    19.             ? _iOSGameId
    20.             : _androidGameId;
    21.         Advertisement.Initialize(_gameId, _testMode, this);
    22.     }
    23.  
    24.     public void OnInitializationComplete()
    25.     {
    26.         Debug.Log("Unity Ads initialization complete.");
    27.     }
    28.  
    29.     public void OnInitializationFailed(UnityAdsInitializationError error, string message)
    30.     {
    31.         Debug.Log($"Unity Ads Initialization Failed: {error.ToString()} - {message}");
    32.     }
    33. }
    34.  
     
    Last edited: Feb 28, 2023
  2. Yasuyuki

    Yasuyuki

    Unity Technologies

    Joined:
    Sep 11, 2014
    Posts:
    152
  3. ByRR

    ByRR

    Joined:
    Jan 11, 2023
    Posts:
    3
    How can i check these ?
     
  4. Yasuyuki

    Yasuyuki

    Unity Technologies

    Joined:
    Sep 11, 2014
    Posts:
    152