[Netcode] Server-Modified NetworkVariable Triggers 'Owner Not Allowed' Error
Under Audit
Unity 2022.3.x - Unity 2023.3.x
Published Fri, Mar 13
Non-host clients encounter "Write Permission (Owner is not allowed)" errors when the server attempts to modify a NetworkVariable configured with NetworkVariableWritePermission.Server.
When utilizing Netcode for GameObjects, a NetworkVariable configured with NetworkVariableWritePermission.Server may incorrectly generate a "Write Permission (Owner is not allowed)" error for non-host clients. This occurs when the server attempts to modify the NetworkVariable's value, for instance, the m_CanMove variable. The error persists even if the modification is initiated via a ServerRpc that specifically targets the client's NetworkObject or if the server directly tries to set the m_CanMove value. The host client (Player 1) does not encounter this issue, suggesting an ownership or permission evaluation conflict specific to server-side writes on client-owned NetworkVariables. This behavior prevents server-authoritative control over states like a player's m_CanMove status, despite the explicit NetworkVariableWritePermission.Server setting.
- Verify the
NetworkObjectassociated with theNetworkVariableis correctly registered and has its ownership resolved on both client and server. - Ensure the
NetworkManageris properly configured for the network topology (host/server-client) being used, and thatNetworkServeris correctly identified. - Consider implementing a custom
INetworkVariableor a more granular permission system if directNetworkVariableWritePermission.Serveris not behaving as expected for specific scenarios.
Editor's Note:
Related Posts Haven't quite found a solution to your problem? We think these posts might help you.
Content inspired by a Unity discussion post.