title: Unity NetworkTransform: synchronize two player
body: <p>I am trying to develop an online pong. i am using masterserver.
  I want my game to synchronize two player on the server, so i check:
   when ones is localplayer, it synchronize movement on server;
   when other player sync on server, it should show movement on other client.</p>
  
  <pre><code>using UnityEngine;
  using System.Collections;
  using UnityEngine.Networking;
  
  public class Movement : NetworkBehaviour {
  
    private Vector2 speedx = new Vector2(3,0);
    private float lastSynchronizationTime = 0f;
    private float syncDelay = 0f;
    private float syncTime = 0f;
    private Vector2 syncStartPosition = Vector2.zero;
    private Vector2 syncEndPosition = Vector2.zero;
  
    // Update is called once per frame
    void Update()
    {
       if (isLocalPlayer)
       {
           InputMovement();
       }
      else
       {
           SyncedMovement();
       }
    }
  
    private void SyncedMovement()
    {
      syncTime += Time.deltaTime;
      GetComponent&lt;Rigidbody2D&gt;().position = Vector2.Lerp(syncStartPosition, syncEndPosition, syncTime / syncDelay);
    }
  
    void InputMovement()
    {
  
      if (Input.GetKey(KeyCode.D))
          GetComponent&lt;Rigidbody2D&gt;().MovePosition(GetComponent&lt;Rigidbody2D&gt;().position + speedx * Time.deltaTime);
      if (Input.GetKey(KeyCode.A))
          GetComponent&lt;Rigidbody2D&gt;().MovePosition(GetComponent&lt;Rigidbody2D&gt;().position - speedx * Time.deltaTime);
    }
  
    void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
    {
      Vector3 syncPosition = Vector3.zero;
      Vector3 syncVelocity = Vector3.zero;
      if (stream.isWriting)
      {
          syncPosition = GetComponent&lt;Rigidbody2D&gt;().position;
          stream.Serialize(ref syncPosition);
          syncVelocity = GetComponent&lt;Rigidbody2D&gt;().velocity;
          stream.Serialize(ref syncVelocity);
      }
      else
      {
          stream.Serialize(ref syncPosition);
          stream.Serialize(ref syncVelocity);
  
          syncTime = 0f;
          syncDelay = Time.time - lastSynchronizationTime;
          lastSynchronizationTime = Time.time;
  
          syncEndPosition = syncPosition + syncVelocity * syncDelay;
          syncStartPosition = GetComponent&lt;Rigidbody&gt;().position;
          Debug.Log("syncstart");
      }
    }
  }
  </code></pre>
  
  <p>Can someone help me synching two players?
  edit:
  when i start server, player of server spawn, but i can't move it.
  when i start client, player of client spawn on server but player of server doesn't show in client window. i can't move both client and server.</p>