Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

NullReferenceException upon enabling Unity Services and ads

Discussion in 'Unity Ads & User Acquisition' started by kalecjason, Jul 19, 2019.

  1. kalecjason

    kalecjason

    Joined:
    Jul 11, 2019
    Posts:
    2
    I recently enabled the unity services as well as ads. I have not added any code as of yet. However upon pressing the play button I am greeted with

    NullReferenceException: Object reference not set to an instance of an object
    System.Net.AutoWebProxyScriptEngine.InitializeRegistryGlobalProxy () (at <c9226b2f33b7421e85bb391f94075e49>:0)
    System.Net.AutoWebProxyScriptEngine.GetWebProxyData () (at <c9226b2f33b7421e85bb391f94075e49>:0)
    System.Net.WebProxy.UnsafeUpdateFromRegistry () (at <c9226b2f33b7421e85bb391f94075e49>:0)
    System.Net.WebProxy..ctor (System.Boolean enableAutoproxy) (at <c9226b2f33b7421e85bb391f94075e49>:0)
    System.Net.WebProxy.CreateDefaultProxy () (at <c9226b2f33b7421e85bb391f94075e49>:0)
    System.Net.Configuration.DefaultProxySectionInternal.GetSystemWebProxy () (at <c9226b2f33b7421e85bb391f94075e49>:0)
    System.Net.Configuration.DefaultProxySectionInternal.GetDefaultProxy_UsingOldMonoCode () (at <c9226b2f33b7421e85bb391f94075e49>:0)
    System.Net.Configuration.DefaultProxySectionInternal.GetSection () (at <c9226b2f33b7421e85bb391f94075e49>:0)
    System.Net.WebRequest.get_InternalDefaultWebProxy () (at <c9226b2f33b7421e85bb391f94075e49>:0)
    System.Net.HttpWebRequest..ctor (System.Uri uri) (at <c9226b2f33b7421e85bb391f94075e49>:0)
    (wrapper remoting-invoke-with-check) System.Net.HttpWebRequest..ctor(System.Uri)
    System.Net.HttpRequestCreator.Create (System.Uri uri) (at <c9226b2f33b7421e85bb391f94075e49>:0)
    System.Net.WebRequest.Create (System.Uri requestUri, System.Boolean useUriBase) (at <c9226b2f33b7421e85bb391f94075e49>:0)
    System.Net.WebRequest.Create (System.String requestUriString) (at <c9226b2f33b7421e85bb391f94075e49>:0)
    UnityEngine.Advertisements.Editor.Platform.Initialize (System.String gameId, System.Boolean testMode) (at /home/builduser/buildslave/com.unity.ads/package/Source/UnityAds/Editor/Platform.cs:89)
    UnityEngine.Advertisements.Advertisement.Initialize (System.String gameId, System.Boolean testMode) (at /home/builduser/buildslave/com.unity.ads/package/Source/UnityAds/Advertisement.cs:229)
    UnityEngine.Advertisements.Advertisement.Load () (at /home/builduser/buildslave/com.unity.ads/package/Source/UnityAds/Advertisement.cs:73)
    UnityEngine.Advertisements.Advertisement.LoadEditor (System.String extensionPath, System.Boolean supportedPlatform) (at /home/builduser/buildslave/com.unity.ads/package/Source/UnityAds/Advertisement.cs:65)
    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <1f0c1ef1ad524c38bbc5536809c46b48>:0)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <1f0c1ef1ad524c38bbc5536809c46b48>:0)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <1f0c1ef1ad524c38bbc5536809c46b48>:0)
    UnityEditor.Advertisements.UnityAdsEditor.EditorOnLoad () (at /home/builduser/buildslave/com.unity.ads/package/Source/UnityAdsEditor/UnityAdsEditor.cs:29)

    I have had no luck finding any answers to what this could be any help would be greatly appreciated.

    Thank you in advance.
     
  2. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    @kalecjason

    Which version of Unity were you using? If it is after 2018.1, can you check which version of Unity Ads you have installed in Package Manager?
     
  3. kalecjason

    kalecjason

    Joined:
    Jul 11, 2019
    Posts:
    2
    I am using Unity 2019.1.8f1 and i am using Ads version 2.0.8
     
  4. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519