playgameservices / play-games-plugin-for-unity

Google Play Games plugin for Unity
Other
3.43k stars 954 forks source link

AssetDatabase.Refresh() - NullReferenceException #1713

Open Honikou opened 7 years ago

Honikou commented 7 years ago

That issue was resolved in 9.35, but still present in 9.37

My plugin works well but that is boring to see this error everytime

In GPGSUpgrader AssetDatabase.Refresh();

ullReferenceException: Object reference not set to an instance of an object UnityEditor.UI.ImageEditor.OnDisable () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEditor.UI/UI/ImageEditor.cs:69) UnityEditor.AssetDatabase:Refresh() GooglePlayGames.Editor.GPGSUpgrader:.cctor() (at Assets/GooglePlayGames/Editor/GPGSUpgrader.cs:110) UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes()

claywilkinson commented 7 years ago

Which version of Unity are you using? I think this is a known issue with 5.3. As you point out, it is harmless, but annoying. If you can't update Unity, you could safely comment out the call to AssetDatabase.Refresh in GPGSUpgrader.

Honikou commented 7 years ago

Thank you for your answer Clay

I'm on 5.6.0f3

I comment but I still have an error, and if I click on the error nothing open.

NullReferenceException: Object reference not set to an instance of an object UnityEditor.Editor.get_referenceTargetIndex () (at C:/buildslave/unity/build/artifacts/generated/common/editor/EditorBindings.gen.cs:162) UnityEditor.AssetImporterInspector.get_referenceTargetIndex () (at C:/buildslave/unity/build/Editor/Mono/ImportSettings/AssetImporterInspector.cs:25) UnityEditor.Editor.get_target () (at C:/buildslave/unity/build/artifacts/generated/common/editor/EditorBindings.gen.cs:148) UnityEditor.AssetImporterInspector.OnDisable () (at C:/buildslave/unity/build/Editor/Mono/ImportSettings/AssetImporterInspector.cs:79) UnityEditor.AssetDatabase:Refresh() Google.PackageManager.ProjectManagerController:EnsurePluginsDirectory() Google.PackageManager.ProjectManagerController:.cctor() UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes()

claywilkinson commented 7 years ago

I can't reproduce your issue, but I do know there has been some updates to the jar resolver. When you have a chance, can you update to the latest version of the plugin and see if that fixes it? You might need to restart Unity to make the DLLs unload and reload correctly... Thanks!

Honikou commented 7 years ago

Thank you for your answer ! Ok I will test that asap.

JinFox commented 6 years ago

Hi, I encountered the same issue today : NullReferenceException: Object reference not set to an instance of an object UnityEditor.UI.GraphicEditor.OnDisable () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEditor.UI/UI/GraphicEditor.cs:27) UnityEditor.AssetDatabase:Refresh() GooglePlayGames.Editor.GPGSUpgrader:.cctor() (at Assets/GooglePlayGames/Editor/GPGSUpgrader.cs:110) UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes()

Plugin version 0.9.39a

Unity version : Version 5.6.0f3 (497a0f351392) Personal Wed, 29 Mar 2017 22:26:44 GMT Branch: 5.6/release

CostelloNicho commented 6 years ago

Don't know if this helps but I Had this same issue with the Facebook SDK for Unity (version 7.10.0)

It happened after I turned off logging in the facebook settings -> fb.init settings. Turning logging back on fixed the problem.

aneeshpanoli commented 6 years ago

Came across this today. This error started showing up after initialising SDK as shown here.

1701Tiberius commented 6 years ago

I am getting the same error after importing the Google Play Services. It does appear benign, but would be great to get rid of. This is with the latest version of the plugin and Unity 2017.2.0f3.

NakOh commented 6 years ago

NullReferenceException: Object reference not set to an instance of an object UnityEditor.Editor.get_referenceTargetIndex () (at /Users/builduser/buildslave/unity/build/artifacts/generated/common/editor/EditorBindings.gen.cs:162) UnityEditor.Experimental.AssetImporters.AssetImporterEditor.get_referenceTargetIndex () (at /Users/builduser/buildslave/unity/build/Editor/Mono/ImportSettings/AssetImporterEditor.cs:25) UnityEditor.Editor.get_target () (at /Users/builduser/buildslave/unity/build/artifacts/generated/common/editor/EditorBindings.gen.cs:148) UnityEditor.Experimental.AssetImporters.AssetImporterEditor.OnDisable () (at /Users/builduser/buildslave/unity/build/Editor/Mono/ImportSettings/AssetImporterEditor.cs:84) UnityEditor.AssetDatabase:Refresh() GooglePlayGames.Editor.GPGSUpgrader:.cctor() (at Assets/GooglePlayGames/Editor/GPGSUpgrader.cs:114) UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes()

Me too. 2017.1.2f

tomerpeled commented 6 years ago

Also encountering this issue with Unity 2017.3.1p2

hapsody commented 6 years ago

also occuring with unity 2017.3.1.f1 personal and GooglePlayGames plug-in version 0.9.50

aneeshpanoli commented 6 years ago

Present in 5.6.5f1 as well. GPGS 0.9.50

p0w1nd commented 6 years ago

I'm also encountering this issue.

NullReferenceException: Object reference not set to an instance of an object UnityEditor.InspectorWindow.OnSelectionChange () (at /Users/builduser/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 /Users/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:295) UnityEditor.HostView.Invoke (System.String methodName) (at /Users/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:288) UnityEditor.HostView.OnSelectionChange () (at /Users/builduser/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()

Unity 2017.4.4f1 GPGS 0.9.50

p0w1nd commented 6 years ago

Update:

I was using PlayServicesResolver v1.2.61.0. I've just replaced it with v1.2.69.0 and that NullReferenceException message disappears.

p0w1nd commented 6 years ago

I was too fast.

I was using PlayServicesResolver v1.2.61.0. I've just replaced it with v1.2.69.0 and that NullReferenceException message disappears.

It was true. I was even careful that I closed Unity and re-opened it, still worked. But then today, I opened Unity, running my game in the Editor and seeing that message again. Argghh.

alkubo commented 5 years ago

phonggenix. did you solve it? i m having the same problem.

p0w1nd commented 5 years ago

@alkubo I didn't do anything but today the message just disappears :/

xatixatix commented 4 years ago

Hi! I was updating achievements and leaderboards before sign in completed, now I call it after a successful login. Now I don't have the error anymore.

bhallionOhbibi commented 3 years ago

Hello !

It's been 3 year already. 😞

In GPGSUpgrader.cs, add thoses lines in the constructor

    /// <summary>
    /// Initializes static members of the <see cref="GooglePlayGames.GPGSUpgrader"/> class.
    /// </summary>
    static GPGSUpgrader()
    {
    #if UNITY_EDITOR
            if (EditorApplication.isPlayingOrWillChangePlaymode)
                    return;
    #endif

I can see why this constructor needs to be called after each Editor reload. But it makes much less sense when entering play-mode.

I'v been using the plugin without trouble using this fix. But with each update it comes back. Can we see this change in the next release of this SDK ?

Cheers ! 🎉

mukhinid commented 3 years ago

@bhallionOhbibi Hi! If you fixed that for you, why don't you create a PR?

bhallionOhbibi commented 3 years ago

Looks like my past self already did it: https://github.com/playgameservices/play-games-plugin-for-unity/pull/2891

My bad. This issue should be closed.

YigitVeloxia commented 3 years ago

I don't know if it's related but I still get this error even after #2891

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.GameObjectInspector.ClearPreviewCache () (at <2f1c602eae0d45c293fff3e3aef759fa>:0)
UnityEditor.GameObjectInspector.ReloadPreviewInstances () (at <2f1c602eae0d45c293fff3e3aef759fa>:0)
UnityEditor.GameObjectInspector.OnForceReloadInspector () (at <2f1c602eae0d45c293fff3e3aef759fa>:0)
UnityEditor.AssetDatabase:Refresh()
GooglePlayGames.Editor.GPGSUpgrader:.cctor() (at Assets/GooglePlayGames/Editor/GPGSUpgrader.cs:104)
UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes(Type[])