I have a NetworkVariable with writePerm: NetworkVariableWritePermission.Owner in one NetworkBehaviour and on that same NetworkObject I have another NetworkBehaviour that uses ChangeOwnership from within a coroutine.
When ownership changes, I notice I get this error sometimes on the host:
[Netcode] Client wrote to NetworkVariable`1 without permission. No more variables can be read. This is critical. => NetworkObjectId: 95 - GetNetworkBehaviourOrderIndex(): 0 - VariableIndex: 0
The code writing to the NetworkVariable is in Update() and I have tried wrapping it with IsOwner and NetworkObject.IsOwner and neither of those prevent this error message.
It seems like maybe there is a race condition here with netcode internals?
I am using netcode 2.4.2 with a Host-Client topology. In this case a host with one additional client.