UnityRef is currently in early development. Some features may be incomplete and/or not functioning.

UNITYREF

Your Pit Stop For Solving ANYTHING in Unity

architecture

[Netcode] Server-Modified NetworkVariable Triggers 'Owner Not Allowed' Error

Under Audit

networkingmultiplayerversion control

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.

Issue

 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.

Experimental Fixes
  • Verify the NetworkObject associated with the NetworkVariable is correctly registered and has its ownership resolved on both client and server.
  • Ensure the NetworkManager is properly configured for the network topology (host/server-client) being used, and that NetworkServer is correctly identified.
  • Consider implementing a custom INetworkVariable or a more granular permission system if direct NetworkVariableWritePermission.Server is not behaving as expected for specific scenarios.

Editor's Note:

The above fixes have not been verified by our audit team yet. They are provided exclusively for your own technical research. We recommend creating a backup of your project before proceeding with any attempts. Utilize at your own discretion!

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.