Why non-player objects that have client authority must have local player authority ?

Hi !

I’m making a multi-player game at the moment, and I’m having trouble to make the setup I want:
When the player connects, the server correctly creates a “Player” object. Then, if the player wants to go into the world, he can click on a “Spawn” button so that the server creates a “Train” object (The game is about driving a train). The keypoint is that there’s a second “player-object”, the “Train” object, which is owned by the client, but the server should still have the authority on it, which is exactly how the “Player” object behaves.

The thing is that I want to be able to call [Command] methods of the “Train” object.
The first time I tried to do that, the engine threw a “Trying to send a command for non local player” message. So I changed the way I spawned the “Train” object:

    [Command]
    public void CmdSpawn() {

        GameObject trainObject = Instantiate(trainPrefab, new Vector3(16, 0, 16), Quaternion.identity) as GameObject;
        // Initialization of the object

        NetworkServer.SpawnWithClientAuthority(trainObject, this.gameObject);

    }

The problem is that the Unity documentation says that:

But I still want the server to be authoritative, and that the server sends “Network Transform” to the client and not the opposite (which would happen if I check the LocalPlayerAuthority property of the “Network Identity” component).
Isn’t it possible for the client to “own” an object (and being able to call [Command] methods on this object) but without having the authority of this object (So that the Position of the object is sent from the server to the client, and not vice-versa) ?

I feel like I don’t understand something, if they made it that way, they must be a reason, but I don’t get why.
Thanks in advance !

Edit: My other solution is to make proxy [Command] methods in the “Player” object that just directly call the method in the “Train” object, but I would have to do a lot of boilerplate code.

Maybe I didn’t explain my question enough clearly, I’ll try to reformulate.

Let’s say I have this code

class Player {

  [Command]
  public void CmdSpawn() {
        GameObject trainObject = Instantiate(trainPrefab) as GameObject;
        // Initialization of the object

        NetworkServer.SpawnWithClientAuthority(trainObject, this.gameObject);
  }
}
class Train {
   
    [Command]
    public void CmdGoForward() {

    }
}

If I don’t check the Local Player Authority property of the Network Identity component, Unity will trigger an alert when I call CmdGoForward saying that the Train GameObject must have Local Player Authority, but I don’t want to check that property because I still want the server to keep the authority on this object.

Is it possible ?
Thanks in advance.

the definition of authority is pretty much “can issue commands”. what do you mean when you say the server should have authority over the train?

The Position of the GameObject should be sent from the Server to the Client, and not the opposite. If I check the property, the Client will send his position to the Server.

I found this thread on Reddit, which describes the same problem.

After some searching, I also found this thread, and the feedback that the OP launched, so it seems like it is a known problem.

It’s a shame, though, it kind of forces developpers to push all the commands in the Player Prefab when it could be nicely decoupled. I hope it will be implemented.