NullReferenceException Test UI

Hi there!

I have NullReferenceException in PlatformBase.cs saying:

NullReferenceException: Object reference not set to an instance of an object
GameSparks.Api.QueuePersistor.Read (GameSparks.Core.GSInstance gsInstance)
GameSparks.Core.GSInstance.InitialisePersistentQueue ()
GameSparks.Core.GSInstance.Initialise (IGSPlatform platform)
GameSparks.Core.GS.Initialise (IGSPlatform gSPlatform)
GameSparks.Platforms.PlatformBase.Start () (at Assets/GameSparks/Platforms/PlatformBase.cs:248)

All I’ve done is include the Gamesparks asset and opened the testui. The same project synced in collab is working for my team mates.

Any ideas?


@pitylee I had this same issue and managed to solve it by setting the private String m_userId to 1234 (any number should work) so,

private String m_userId="1234";

and then in your player settings enter GS_DONT_USE_PLAYER_PREFS in the Scripting Define Symbols in the Other Settings tab, dont forget to save with ctrl + s to save the field and thats it.

For me this solved the issue was quite bizzare one actually.

Hope this helps!

Just ran in to this - GameSparks is saving some data via PlayerPrefs which gets saved to the registry.

[HKCU] → Unity → Unity Editor → YOUR COMPANY → YOUR APP

Delete the keys starting with ‘gamesparks’ - this fixed it for me.

I had same issue, and the workaround that just set the userid to any non-empty string should solve the issue.
You can do this by setting a breakpoint (at Assets/GameSparks/Platforms/PlatformBase.cs:248), and change the userid value in your IDE

I still have this problem and nothing actually helps from the above. Anyone else found solution ?

You would need to see the code on line 248 of the PlatformBase.cs script to tell, but it looks like some reference wasn’t set up in the inspector or some resource is not available (maybe another manager script in the scene? It’s communicating with singletons, maybe they need to be added to the scene, or maybe they are initialized in the wrong order and you have to set up custom script execution order for your project). If you don’t have source code access and there’s nothing obvious to find, you should contact the package’s author. :wink: