Sync Gameobject position over the server dont work !! Bug ?5.5 ?

hi
i want to sync a gameobject position like a car but it dont working here my sync script.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.Networking.NetworkSystem;
public class NetPlayer : NetworkBehaviour
{
    void Update()
    {
       // Debug.Log("isLocalPlayer");
      
            // [...] code to update the position of the player.
            Debug.Log("isLocalPlayer");
            // send to the server my new position.
            CmdMove(transform.position);
       
    }

    [Command]
    void CmdMove(Vector3 position)
    {
        Debug.Log("server");
        // we trust the player :)
        transform.position = position;
        SetDirtyBit(1u);
    }

    public override bool OnSerialize(NetworkWriter writer, bool initialState)
    {
        writer.Write(transform.position);
        return true;
    }

    public override void OnDeserialize(NetworkReader reader, bool initialState)
    {
      
         

        transform.position = reader.ReadVector3();
    }
}

The client controller the car and the script must´!!! sync the position to the server but it dont why ?!!
Hope someone can help thx

It’s my guess that by ‘not working’ you basically mean that you’re able to see the movements on your end but not able to see them on a second client. Have you tried a ClientRpc to sync across all clients, called from CmdMove? Ignoring that, you could try SyncVar. I’m not sure how useful (Or accurate) it is, since I’m just getting into using all these things, but a lot of people recommend it for syncing variables like this.

Though there’s actually a built-in component intended for this exact purpose. NetworkTransform. Try throwing a NetworkTransform on the object and see if it automatically updates. Mine’s been working fine. One note, though: You’ll probably have to change one setting. “Transform Sync Mode” seems to do its best when it’s changed to “Sync Transform.” I haven’t found an instance where any of the other options have done anything useful yet.

hi thx for your anwser
So i found this works but this only working when you using your player prefab that you using in the network manager.
When you dont using it it dont work.
Every item that is in the game like a car … it dont syn it when you moving it from your client also when you change local server or nothing it not working because its not the prefab in the network manager.
So thats very bad so i cant move my car because its not the prefab and i cant using the ClientRpc because this reason and the other things like CmdMove SyncVar etc not working its not the prefab!!

I’ll have to experiment with a couple items for rotation soon anyway, so I’ll see if I can get uncontrolled objects to sync. I haven’t been in a situation to try it yet - been having enough difficulty figuring out the basics as-is, given the lack of dumbed-down extensive coverage uNet has…

hi i found a way but not really working there are 2 ways
1 of them it works to 50% the other not working for me

public Transform spawnpoint;
    public GameObject prefab;
    // Use this for initialization
    void Start () {
       
    }
   
    // Update is called once per frame
    void Update () {
        if (Input.GetKeyDown(KeyCode.J))
        {

            if (isLocalPlayer)
            {
              
            CmdSpawn();
            }

            //GameObject obj = (GameObject)Instantiate(prefab, spawnpoint.position, spawnpoint
            //    .rotation);
            //NetworkServer.Spawn(obj);
        }
    }
    [Command]
    void CmdSpawn()
    {
        Debug.Log("testspawn");
        var go = (GameObject)Instantiate(prefab, spawnpoint.position,
           spawnpoint.rotation);
         NetworkServer.SpawnWithClientAuthority(go, connectionToClient);
        //NetworkServer.Spawn(go);
    }

this code works it spawn my object with a WithClientAuthority but the server dont spawn the object lol
And this is the problem when somone going in he cant see the last object that spawning from other player.

2 this dont working
https://docs.unity3d.com/Manual/UNetConcepts.html

GetComponent().AssignClientAuthority(connectionToClient);
this not works but maybe it works when it do it right but now i become only errors that my object is null.
AssignClientAuthority for Apple(Clone) (UnityEngine.GameObject) owner cannot be null. Use RemoveClientAuthority() instead.

Maybe this will help you or me https://forum.unity3d.com/threads/create-a-container-and-then-assignclientauthority.386022/

for the solution.