I was working on some project which required this specific verion of Unity editor 2021.3.9f1
Ya the update to 2022 was to let me get the connection working the build (which it did), but doesnât solve the bug you were having, which I am looking into now.
Well the core of it, is that AFTER the host disconnects, it tries to clean up all the leaderboard entity states network list. These states have been begun being cleaned up by Unity already. For whatever reason in Netcode for GameObejcts 1.6 or in your version of the project, itâs trying to clean up the clientâs network state first before the serverâs.
I suppose if we could find a way to indicate to the leaderboard that the server has started disconnecting, we could avoid running this code altogether, but I couldnât find an existing flag for that accessable by this class.
If we look at the exact line causing the bug in the NetworkList class:
internal void MarkNetworkObjectDirty(
{
if (m_NetworkBehaviour == null)
{
Debug.LogWarning($"NetworkList is written to, but doesn't know its NetworkBehaviour yet. " +
"Are you modifying a NetworkList before the NetworkObject is spawned?");
return;
}
m_NetworkBehaviour.NetworkManager.BehaviourUpdater.AddForUpdate(m_NetworkBehaviour.NetworkObject);
}
Essentially the list has lost itâs connection to either the NetworkManager or the behaviour updater.
Honestly, this is on Unity, they need more null checks in here to handle other cases. We canât modify the NetworkList class as itâs immutable. The line causing the bug has 3 nested periods in it, which is not the best practice for this very reason.
I couldnât find any check or state to verify in the LeaderBoard class that would tell us if this list is in the process of being dismantled when we are checking it.
I think you best bet is just to log this error with Unity and ask them to fix it on their end. Sorry I could not be more help. This error does not seem to occur in Netcode for GameObjects 1.4, so if you want to revert to that version to avoid the error you can.
Thank you @Yitzchak_Cohen for your detail investigation.
Iâm indeed using NGO 1.6 version
I will try to switch version, and try to post this error to Unity is some future time
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.