Mirror icon indicating copy to clipboard operation
Mirror copied to clipboard

NetworkTransform with clientAuthority set true cannot be moved by server when no client has authority

Open brainwipe opened this issue 3 years ago • 2 comments

When you have a game object with a NetworkTransform with clientAuthority set to true, it can only be moved by clients with authority. When no client has authority (i.e. the server has authority), it cannot be moved by the server.

Is this intentional behaviour?

I would expect the server to be able to move the object when no client has authority. This was the behaviour in previous versions of Mirror.

I believe the issue is in NetworkTransformBase where the serverBuffer is used when clientAuthority is set and current client has no authority on this line.

Demonstration Project I've set up a simple project with the smallest amount of code. There's only empty player objects and a cube that moves vertically when the server has authority.

Start up a build as the client and the unity editor as host. The cube is being moved automatically by the server (when connection to client is null).

When clientAuthority on the Network Transform is checked then the cube stops because the server is not able to move the cube (that's the bug).

Uncheck clientAuthority and the cube moves.

https://user-images.githubusercontent.com/1922279/172066366-6160c7be-ac2b-482f-afac-6551ccd1ad4c.mp4

Desktop (please complete the following information):

  • OS: Windows
  • Build target: Windows
  • Unity version: 2021.1.25f
  • Mirror branch: release version 66

Many thanks in advance!

brainwipe avatar Jun 05 '22 19:06 brainwipe

FYI I don't need tis answering anymore but leaving for posterity.

brainwipe avatar Jun 27 '22 19:06 brainwipe

Hello I updated Mirror in a project and having that problem now too. I also figured out that moving objects around on the multiple clients has problems. It seams that they have different last states that replace the object when the authority is lost. That leads to the problem that objects are not on the same position on the different devices.

@brainwipe May i ask how you solved the problem? Would it make sense to turn on and off the clientAuthority on all clients+server at runtime when needed?

Mirror Version 66.0.9 Unity 2021.3.1f1 Tested devices: Mac Book, Windows 10, Oculus Quest 2

ChrisEL20 avatar Sep 07 '22 15:09 ChrisEL20

Closing this as the original issue is resolved.

@ChrisEL20 Please create a new ticket with your issue, or join our Discord for support.

MrGadget1024 avatar Nov 24 '22 11:11 MrGadget1024