Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Adduplex error WP 8.1

Discussion in 'Windows' started by White8eard, Mar 22, 2016.

  1. White8eard

    White8eard

    Joined:
    Aug 4, 2014
    Posts:
    61
    i have been trying to integrate adduplex..i have added the code as per few tutorials

    i get the ad working fine when i load main menu for first time...but it is screwed when i come back to main menu after the game.

    Unhandled 'Phantom.nullreferenceexception'exception caught - invalid exception

    object reference not set to instance of an object sender<null> missing try/catch block.

    Code (CSharp):
    1.  private async void Interop_ShowInterstitialEvent(object sender, EventArgs e)
    2.         {
    3.             InitializeInterstitialAd();
    4.             await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
    5.                        async () =>
    6.                        {
    7.                            InitializeInterstitialAd();
    8.                            await ad.ShowAdAsync();
    9.                        });
    10.         }
    11.  
    12.         private async void Interop_LoadInterstitialEvent(object sender, EventArgs e)
    13.         {
    14.             InitializeInterstitialAd();
    15.             await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
    16.                        async () =>
    17.                        {
    18.                            InitializeInterstitialAd();
    19.                            await ad.LoadAdAsync();
    20.                        });
    21.         }
    22.  
    23.         private async void InitializeInterstitialAd()
    24.         {
    25.             //AdDuplexClient.Initialize("4f32ccc5-61cb-4f0d-97c8-2c917618cecc");
    26.             await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
    27.                        () =>
    28.                        {
    29.                            ad = new InterstitialAd("188927");
    30.                        });
    31.         }