- Home /
State synchronization non-functional after mode change?
Hello all,
I have summoned an instance of a sip on the server (after all clients have connected) using this code:
public class ShipSetup : MonoBehaviour {
void Start () {
Ship s=(Ship) Network.Instantiate(shipPrefab,new Vector3(i*100,0,0),Quaternion.Euler(0,-90,0),4);
}
}
The prefab has a NetworkView that is observing the ship's Rigidbody. The mode is set to 'Off' in the editor. This is so that each player can rotate the object separately in a preparation phase.
The ship is added to a List locally on all machines for easy access:
public class Ship : MonoBehaviour {
void Start () {
DontDestroyOnLoad(gameObject);
Coordinator.getInstance().ships.Add(this);
}
}
However, when the world loads (after preparation) the server needs to take control of the physics. I want to turn on state synchronization upon the camera starting on all machines:
public class World : MonoBehaviour {
void Start () {
foreach (Ship s in Coordinator.getInstance().ships) {
s.networkView.stateSynchronization=NetworkStateSynchronization.Unreliable;
}
}
}
I can see that both the client and the server have the mode set to Unreliable in the editor at this point. However, when the ship is moved on the server the clients do not reflect the movement.
Other objects in the scene (part of the map) move and update the client but not the ships.
Any idea why the updates aren't getting through?