Unity 2017.1 Unity's Ad UI not working in Editor

I have my project set to an Android platform build and the Unity’s Ad UI window that usually shows in the editor is not working correctly. However when I compile and run the game on my phone the Ad video does seem to work correctly. I keep getting an error initializing unity ad’s in the editor. Is there any known bugs with Unity’s advertisement system using Unity version 2017.1.0f3

Not that we’re aware of at least. We’re using Unity 2017.1 for developing our own games and our usual automation is running on 2017.1 as well. What error do you get during initialization?

/Rasmus

Below is the error message. I’m using Unity 2017.10.f3.

NullReferenceException: Object reference not set to an instance of an object
System.Net.AutoWebProxyScriptEngine.InitializeRegistryGlobalProxy () (at :0)
System.Net.AutoWebProxyScriptEngine.GetWebProxyData () (at :0)
System.Net.WebProxy.UnsafeUpdateFromRegistry () (at :0)
System.Net.WebProxy…ctor (System.Boolean enableAutoproxy) (at :0)
System.Net.WebProxy.CreateDefaultProxy () (at :0)
System.Net.Configuration.DefaultProxySectionInternal.GetSystemWebProxy () (at :0)
System.Net.Configuration.DefaultProxySectionInternal.GetDefaultProxy_UsingOldMonoCode () (at :0)
System.Net.Configuration.DefaultProxySectionInternal.GetSection () (at :0)
System.Net.WebRequest.get_InternalDefaultWebProxy () (at :0)
System.Net.HttpWebRequest…ctor (System.Uri uri) (at :0)
(wrapper remoting-invoke-with-check) System.Net.HttpWebRequest:.ctor (System.Uri)
System.Net.HttpRequestCreator.Create (System.Uri uri) (at :0)
System.Net.WebRequest.Create (System.Uri requestUri, System.Boolean useUriBase) (at :0)
System.Net.WebRequest.Create (System.String requestUriString) (at :0)
UnityEngine.Advertisements.Editor.Platform.Initialize (System.String gameId, System.Boolean testMode) (at C:/buildslave/unity/build/Extensions/UnityAds/UnityAds/Editor/Platform.cs:89)
UnityEngine.Advertisements.Advertisement.Initialize (System.String gameId, System.Boolean testMode) (at C:/buildslave/unity/build/Extensions/UnityAds/UnityAds/Advertisement.cs:229)
UnityEngine.Advertisements.Advertisement.Load () (at C:/buildslave/unity/build/Extensions/UnityAds/UnityAds/Advertisement.cs:73)
UnityEngine.Advertisements.Advertisement.LoadEditor (System.String extensionPath, System.Boolean supportedPlatform) (at C:/buildslave/unity/build/Extensions/UnityAds/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 /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:305)
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 /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:313)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[ ] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/referencesource/mscorlib/system/reflection/methodbase.cs:229)
UnityEditor.Advertisements.UnityAdsEditor.EditorOnLoad () (at C:/buildslave/unity/build/Extensions/UnityAds/UnityAdsEditor/UnityAdsEditor.cs:29)

We had a similar issue a long time ago (Unity 5.3) when game id was null, but that should have been fixed.

You can check ProjectSettings/UnityConnectSettings.asset if game ids are set (remember to change serialization to text in Edit->Project Settings->Editor menu) or if you can somehow share project, you are welcome to send me a PM with info.

Thanks,
Rasmus

Error fixed for now. I previously changed Scripting Runtime Version to “Experimental (.NET 4.6 Equivalent)” under the PlayerSettings → Other Settings → Configure Section . I changed it back to “Stable (.NET 3.5 Equivalent)” and fixed the error. So long story short keep Scripting Runtime Version option set to “Stable (.NET 3.5 Equivalent)” for now.

i am getting this exact error with unity2019.3.0f6
with intialzing the unity ads i get this error
now there is no scripting runtime version setting in other settings
there is only Api compatabilty level
but changing that also doesnt remove the error
help!!!

1 Like

ya mee too! i am facing the same problem with unity2019.3.6f1!
please help me …

#meToo

wtf oO 2019.3.0f6

Hi all,

Since nobody seems to be linking to the problem, I will. It’s actually an underlying bug in the mono framework: Bug: AutoWebProxyScriptEngine.InitializeRegistryGlobalProxy · Issue #10030 · mono/mono · GitHub

I’m having the same issue in custom code in my game to do Http Web requests:

       var request = (HttpWebRequest)WebRequest.Create(url);
                request.Timeout = (i + 1) * 10000;
                var response = (HttpWebResponse)request.GetResponse();

I’m still trying to find a way to fix it in-code so the users don’t have to do anything, but the problem lies in the fact that they have enabled a proxy in windows without actually configuring a url to a proxy.

The user-side fix is simple:

Just turn that off and you’re golden!

3 Likes