question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NullReferenceException: Object reference not set to an instance of an object

See original GitHub issue

When I call NetworkManager.Singleton.Shutdown() on host side, the client in editor will crash with the following output:

NullReferenceException: Object reference not set to an instance of an object
Unity.Netcode.NetworkManager.OnNetworkEarlyUpdate () (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.3/Runtime/Core/NetworkManager.cs:1155)
Unity.Netcode.NetworkManager.NetworkUpdate (Unity.Netcode.NetworkUpdateStage updateStage) (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.3/Runtime/Core/NetworkManager.cs:1125)
Unity.Netcode.NetworkUpdateLoop.RunNetworkUpdateStage (Unity.Netcode.NetworkUpdateStage updateStage) (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.3/Runtime/Core/NetworkUpdateLoop.cs:149)
Unity.Netcode.NetworkUpdateLoop+NetworkEarlyUpdate+<>c.<CreateLoopSystem>b__0_0 () (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0-pre.3/Runtime/Core/NetworkUpdateLoop.cs:172)

I add Debug.Log so the line number may be different.

MessagingSystem.ProcessIncomingMessageQueue();

The problem is that, in OnNetworkEarlyUpdate, MessagingSystem is null.

how to avoid this? Or I call shutdown inproperly?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
NaolShowcommented, Dec 23, 2021

Same problem here

0reactions
ashwinimurtcommented, Mar 29, 2022

Fixed in 1.0.0-pre.6. Please reopen if you are still seeing the issue. Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Object Reference Not Set to an Instance of an Object
This exception is thrown when you try to access a member—for instance, a method or a property—on a variable that currently holds a...
Read more >
c# - What is a NullReferenceException, and how do I fix it?
The message "Object not set to an instance of Object" means you are trying to use an object which has not been initialized....
Read more >
Object reference not set to an instance of an object” error?
The “Object reference not set to an instance of an object” is a very famous error in C# that appears when you get...
Read more >
How can I fix the error: System.NullReferenceException
When you have a statement like A.B.C = E.F; , and you receive an NullReferenceException 'Object reference not set to an instance of...
Read more >
Question - Object reference not set to an instance of an object
It's simply a mistake in your code where you're referring to something that isn't set to refer to any object so is null....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found