- Home /
MessagingSystem.ProcessIncomingMessageQueue();, NullReferenceException: Object reference not set to an instance of an object
Im using unity's netcode with a steamP2P transport, and i have just a basic project with the minimum setup needed to have a client connect to a host. But for some reason, after about 10 seconds of the client being connected to the host, i get a "NullReferenceException: Object reference not set to an instance of an object" in NetwrokManager.cs, at line 1144: MessagingSystem.ProcessIncomingMessageQueue();. . I dont know how this problem could have raised, as i have not edited or altered NetworkManager.cs in anyway, and i dont even know where to start as to why this could be occurring.
Any help would be appreciated.
[EDIT] After doing some more testing, when attempting to run a ServerRpc from the client (as in not the host):
[ServerRpc(RequireOwnership = false)]
void SyncServerRpc()
{
Debug.Log("ServerRpc test");
}
I get the "NullReferenceException: Object reference not set to an instance of an object" error again, but this time its at NetworkManager.cs line 1380:
return MessagingSystem.SendMessage(message, delivery, clientId);
Keep in mind, both ClientRpc and ServerRpc work if done from the host.
which i couldnt find elsewhere via googling. I hope this helps.
[SIDE ERROR] I WAS also getting a wierd error that was printing to the console: "Library\PackageCache\com.unity.netcode.gameobjects@1.0.0-pre.2\Runtime\Core\NetworkManager.cs is outside of Assets Folder, falling back to OS script editor... "
I managed to fix the problem by doing this:
(((To clarify, this does NOT fix the main problem)))
After moving com.unity.netcode.gameobjects@1.0.0-pre.2, I then had to enable Preview Packages from the Package Manager section in my project settings, then i had to download com.unity.collections and https://github.com/needle-mirror/com.unity.nuget.mono-cecil.git , Since unity didnt seem to recognize those anymore.
This did NOT fix the messaging error however.
I have the same problem as you @leonhogan1 and I can't fix it. I tried installing om.unity.collections and com.unity.nuget.mono-cecil like you did and it did not work, I still get the Messaging null reference error.
In my project, I am only trying to connect a client to a host via the SteamP2PTransport but after a few seconds, the client disconnects and the error is thrown.
Also, I don't understand what you mean when you say "After moving com.unity.netcode.gameobjects@1.0.0-pre.2", what do you mean by that?
Am I missing a step? Thanks!
Sorry, let me clarify. The "Library\PackageCache\com.unity.netcode.gameobjects@1.0.0-pre.2\Runtime\Core\NetworkManager.cs is outside of Assets Folder" error was another error i was receiving. My solution to that error did NOT fix the main error unfortunately.
Answer by salvator23 · Nov 09, 2021 at 08:32 PM
Having the same issue: Using Unitys netcode with the steamp2p transport, but i am not able to properly connect as a client. The ServerRPC called by the client is not executed on the host and i am getting the same NullReferenceException you mentioned after some seconds.
Did you make some progress on this?
The best thing to do would be to open an issue on the Netcode GitHub. Share it here if you make one.
I opened an issue on the tranport repo: https://github.com/Unity-Technologies/multiplayer-community-contributions/issues/122
Smart thinking, thanks for setting that up.
Your answer
Follow this Question
Related Questions
Steamworks.NET check if Steam is offline 1 Answer
Unity Subsystems 1 Answer
Unity built in Steamworks P2P API 0 Answers
are client hosted servers limited by my 20 person ccu? 0 Answers