NullReferenceException: Object reference not set to an instance of an object
See original GitHub issueWhen 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:
- Created 2 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Same problem here
Fixed in 1.0.0-pre.6. Please reopen if you are still seeing the issue. Thanks.