First: tx for the great work.
There seems to be a NullReferenceException when the plugin tries to call GPGSUpgrader.cs at line 114.
Not sure what the cause is, so I just past the error here:
NullReferenceException: Object reference not set to an instance of an object
UnityEditor.InspectorWindow.OnSelectionChange () (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:148)
System.Reflection.MonoMethod.Invoke (System.Object obj, 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:222)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, 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:232)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:285)
UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:278)
UnityEditor.HostView.OnSelectionChange () (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:167)
UnityEditor.AssetDatabase:Refresh()
GooglePlayGames.Editor.GPGSUpgrader:.cctor() (at Assets/GooglePlayGames/Editor/GPGSUpgrader.cs:114)
UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes()
Line 114 of GPGSUpgrader.cs is:
AssetDatabase.Refresh();
There might be a problem of communication between unity and the plugin?
Issue #1433 seems related but is not exactly the same.
For the sake of similar topics. I also received this null reference error in the same version of unity and the plugin
NullReferenceException: Object reference not set to an instance of an object
GooglePlayServices.AndroidSdkManager+
GooglePlayServices.SdkManager+
GooglePlayServices.SdkManagerUtil+
GooglePlayServices.CommandLineDialog+ProgressReporter.Update (GooglePlayServices.CommandLineDialog window)
GooglePlayServices.CommandLineDialog.Update ()
System.Reflection.MonoMethod.Invoke (System.Object obj, 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:222)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, 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:232)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:285)
UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:278)
UnityEditor.HostView.SendUpdate () (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:354)
UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at C:/buildslave/unity/build/Editor/Mono/EditorApplication.cs:127)
Same issue here
Been there for at least 6 months in one of our projects...
Would love to hear ideas about what's causing this.
It's kinda embarrassing being asked about it then and again... Perhaps I should do a clean plugin install on our app. 馃憤
_I'm guessing the newer versions of GooglePlayGames installs incorrectly if an older version of the plugin existed, most likely unity's fault_
Reproducible on unity 5.6.3p1 and 2017.1.0f3



GooglePlayGamesPlugin-0.9.42
Unity 2017.2.0f3

My guess is, you put the main camera in button iu on click. If you call the script GameObject instead, it will not give an error.
I hope that helped.
Following an idea on another thread I moved my project to C:\ which 'solved' the error though I don't understand why.
My main camera follows a ball triggered on a panel 'drag' - Event Trigger Pointer Down then Pointer Up
Same issue with the same versions. No previous versions of "play-games-plugin-for-unity" plugin was installed for this project.
I'm in the same situation but my issue is solver by rebooting Unity...
facing same issue.
Can anybody tell me what to do?
My project is almost ready except this error.
Sometimes when you restart unity it goes away.
Same issue here and i believe that is why i am stuck at trying to make gpg work for weeks!
Can any of you login to your games while you have this error ? It doesn't prevent me from compiling and playing but I believe this is why my GPG is not working.
Please help
Here is the full message
NullReferenceException: Object reference not set to an instance of an object
UnityEditor.InspectorWindow.OnSelectionChange () (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:147)
System.Reflection.MonoMethod.Invoke (System.Object obj, 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:222)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, 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:232)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:295)
UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:288)
UnityEditor.HostView.OnSelectionChange () (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:168)
UnityEditor.AssetDatabase:Refresh()
GooglePlayGames.Editor.GPGSUpgrader:.cctor() (at Assets/GooglePlayGames/Editor/GPGSUpgrader.cs:114)
UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes()
@Yigityakut I still have the issue, nothing changed, but it does not affect my ability to access GPG.
Everything works fine, the issue is mostly cosmetics for me.
@TheGiezi Thank you for your answer. I realized that these are not related because after 2 3 restarts to the unity, it disappeared for now. Everything in my game is ready and I cant release it because of a stupid leaderboard for more than a month. I am stuck. Appreciate the help though.
@Yigityakut Try comment out the call to AssetDatabase.Refresh in GPGSUpgrader safely. It worked for me. Got the idea from this link.. https://github.com/playgameservices/play-games-plugin-for-unity/issues/1433
@jidekrm A bit more nice way is to add check if (!EditorApplication.isPlayingOrWillChangePlaymode) before AssetDatabase.Refresh() call, because thsi annoying thing happens when you start playmode. Don't know when this property was introduced, though...
AssetDatabase is a Unity Class.
It just so happens that Google tells it to go looking for asset changes and 'refresh'
https://docs.unity3d.com/ScriptReference/AssetDatabase.Refresh.html
Some time down the refresh process unity sometimes finds some asset with a null ref and throw this. It's got nothing to do with GPGS.
I vote for a engineer from google to put the reason below for why they call AssetDatabase.refresh and close this request.
Don't see anything that could be done on google's side.. except stop calling this taxing refresh..
I really think shouldn't be AssetDB.Refresh() shouldn't be called often.
I'm getting a NullReferenceException "UnityEditor.GameObjectInspector.ClearPreviewCache ()" after using PlayGameServices too. Happens on every run. Using Unity 2019.2.0f1
Edit: As Antonz0 was mentioning, you could probably even stick EditorApplication.isPlayingOrWillChangePlaymode at the top with a return. Because it's an "InitializeOnLoad", and that's getting called on play mode, which wouldn't make sense for the upgrader to run anyway.
So stick:
if (EditorApplication.isPlayingOrWillChangePlaymode)
return;
At the top of the static constructor GPGSUpgrader() and call it a day.
Edit: Although it still doesn't stop the random NRE's during script compile.
Most helpful comment
Sometimes when you restart unity it goes away.