Search Unity

[SOLVED]Can't sync transform from client.

Discussion in 'Multiplayer' started by Shaka, Jan 23, 2016.

  1. Shaka

    Shaka

    Joined:
    Apr 24, 2010
    Posts:
    51
    I have no idea what I'm doing wrong but it's driving me insane!

    I have a simple scene with a NetworkManager to which I've assigned a Player Prefab 'TestPlayer'. The object is a simple cube to which I've added a NetworkIdentity and a NetworkTransform which is configured to sync transform.
    I use the Network HUD to host/join a server.
    The problem I'm having is that the transform of player prefab owned by the server is synced to the clients but not vice versa. I've also added a movement script 'NetworkDude':

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using UnityEngine.Networking;
    4.  
    5. public class NetworkDude : MonoBehaviour {
    6.     void Update() {      
    7.         if(GetComponent<NetworkBehaviour>().isLocalPlayer) {          
    8.             var x = Input.GetAxis("Horizontal") * 0.1f;
    9.             var z = Input.GetAxis("Vertical") * 0.1f;
    10.  
    11.             transform.Translate(x, 0, z);
    12.         }
    13.     }
    14. }
    15.  
    Any clues to what I'm doing wrong?
     
  2. Shaka

    Shaka

    Joined:
    Apr 24, 2010
    Posts:
    51
    Updated my Unity installation to 5.3.1.1f (I'd 5.3.0.1f installed) and now it works :p
     
unityunity