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 the NetworkVariable of NetworkObject A.
- Spawn NetworkObject D with an
OnNetworkDespawn function that modifies the NetworkList of NetworkObject B.
- Shut down the Server. Notice errors thrown by
NetworkVariableBase.cs and NetworkList.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
Description
When
Shutdown()is called on the Server and a NetworkObject'sOnNetworkDespawncauses a different NetworkObject to modify aNetworkListorNetworkVariablethat's attached to it, aNullReferenceExceptionis thrown.For
NetworkList.cs, the exception gets thrown in theMarkNetworkObjectDirtyfunction on line78.For
NetworkVariableBase.cs, it gets thrown onSetDirtyfunction on line98.This didn't happen on NGO version
1.2.0. Could be dependant on script execution order somehow?Reproduce Steps
NetworkVariableattached to it.NetworkListattached to it.OnNetworkDespawnfunction that modifies theNetworkVariableof NetworkObject A.OnNetworkDespawnfunction that modifies theNetworkListof NetworkObject B.NetworkVariableBase.csandNetworkList.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
2022.3.4f11.5.1