I have a button that spawns in a gameobject with a Network Rigidbody and a Network transform.
The game object prefab is at (0,0,0). But If I want to set an initial position to (-3,0,0), what I see on the client is an object spawning at (0,0,0) then quickly sliding into place at (-3,0,0).
Even if I look carefully on the server instance, I see a brief flash where the object is at (0,0,0).
What am I missing here?
public class RobotControl : NetworkBehaviour
{
new private Rigidbody rigidbody;
public Vector3 defaultPosition = new Vector3(-3, 0, 0);
public override void OnNetworkSpawn()
{
if (NetworkManager.Singleton.IsServer){
rigidbody = GetComponent<Rigidbody>();
rigidbody.position = defaultPosition;
}
}
}
I’m running netcode 1.2.0