-
Notifications
You must be signed in to change notification settings - Fork 457
Description
Description
When Shutdown()
is called on the Server and a NetworkObject's OnNetworkDespawn
causes a different NetworkObject to modify a NetworkList
or NetworkVariable
that's attached to it, a NullReferenceException
is thrown.
For NetworkList.cs
, the exception gets thrown in the MarkNetworkObjectDirty
function on line 78
.
For NetworkVariableBase.cs
, it gets thrown on SetDirty
function on line 98
.
This didn't happen on NGO version 1.2.0
. Could be dependant on script execution order somehow?
Reproduce Steps
- Spawn NetworkObject A with a
NetworkVariable
attached to it. - Spawn NetworkObject B with a
NetworkList
attached to it. - Spawn NetworkObject C with an
OnNetworkDespawn
function that modifies theNetworkVariable
of NetworkObject A. - Spawn NetworkObject D with an
OnNetworkDespawn
function that modifies theNetworkList
of NetworkObject B. - Shut down the Server. Notice errors thrown by
NetworkVariableBase.cs
andNetworkList.cs
.
I'm not sure if this is a reliable way to reproduce the issue and I don't currently have a small sample project to reproduce it in.
Actual Outcome
NetworkVariableBase and NetworkList cause a NullReferenceException when modified during server shutdown.
Expected Outcome
No exceptions are caused when modifying a NetworkVariable or a NetworkList during server shutdown.
Environment
- OS: Windows 10
- Unity Version:
2022.3.4f1
- Netcode Version:
1.5.1
- Netcode Commit: 7a969f8