Cannot figure out why i have problem with sync GameObject

I am using a SyncPosition script instead of the NetworkTransform component as with the component sync is not working correctly. When i use the SyncPosition script the following happening:

  1. From the Server/Client side sync. is working perfectly
  2. On the Client side the object is hard to move. Ii is like a rubber band the object is moved only a short distance and behave like there is a rubber band connected.

Again, when using the NetworkTransform component all work perfectly.

Here is the SyncPosition script:

using UnityEngine;
using System.Collections;
using UnityEngine.Networking;

public class SyncPosition : NetworkBehaviour {

    private Transform myTransform;
    [SerializeField] float lerpRate = 15;
    [SyncVar] private Vector3 syncPos;

    void Start () {
        Cmd_DoStuff ("Start");
        myTransform = GetComponent<Transform> ();
    }

    void Update () {
        TransmitPosition ();
        LerpPosition ();
    }

    void LerpPosition () {
    
        if (!isLocalPlayer) {
            Cmd_DoStuff ("!isLocalPlayer LerpPosition");
            myTransform.position = Vector3.Lerp (myTransform.position, syncPos, Time.deltaTime * lerpRate);
        }
    }

    [Command]
    void Cmd_ProvidePositionToServer (Vector3 pos) {
        syncPos = pos;
    }

    [ClientCallback]
    void TransmitPosition () {
        Cmd_ProvidePositionToServer (myTransform.position);
    }

    [Command]
    void Cmd_DoStuff(string myStr) {
        print (myStr);
    }

}

I also get the following message:

Hey

Have you added the component network identity onto the player and made it so that it is checked for local player?

You only want to transmit the position data for a local player. So you need to add an if (isLocalPlayer) check in your TransmitPosition function. Without the check, you transmit data for other clients objects as well (without having authority of course).

BTW, with your current implementation you transmit the data on each Update() tick. Depending on the frame rate, this might be transmission at a higher interval than you actually want/need (also considering network bandwidth consumption).

Thanks. I am currently travel and will test this on Wednesday. I am aware that I consume a lot of bandwidth but will fix that when this works accordingly.

Really appreciate your help.

Thanks. Yes.

Tested and it did not work. With this update i get the same situation on both sides, this changed the host side.

I think, what seems to happening is that when i draw the object and release it it returns back to the same position. The rubber band effect i see is because the Lerp i guess.

Tested and it did not work. With this update i get the same situation on both sides, this changed the host side.

I think, what seems to happening is that when i draw the object and release it it returns back to the same position. The rubber band effect i see is because the Lerp i guess.

[solved], solution in this post: Does my SyncVar really works? - Unity Engine - Unity Discussions