Hii, i’m investigating netcode for gameobjects and doing a test I can’t move the client player. When I connect to the server, the “EmptyPrefab” only has the component networkobject, in order to spawn one player or another (classes etc), I have done it with this code;
public override void OnNetworkSpawn()
{
base.OnNetworkSpawn();
clientID = (int)OwnerClientId;
if (IsOwner)
{
player = SpawnPlayer();
}
}
// Update is called once per frame
public GameObject SpawnPlayer()
{
GameObject[ ] spawnPoints = GameObject.FindGameObjectsWithTag(“SpawnPoint”);
GameObject go = Instantiate(player, spawnPoints[Random.Range(0, spawnPoints.Length - 1)].transform.position, Quaternion.identity);
go.GetComponent().SpawnWithOwnership(OwnerClientId);
return go;
}
In the spawned player i did just this only to test :
private void Update()
{
GetComponentInChildren().enabled = true;
GetComponentInChildren().enabled = true;
GetComponent().enabled = true;
GetComponent().enabled = true;
}
I added the ClientTransformNetwork and nothing happens, i can’t even move the character in the client itself, does anyone know what might be happening? Ty.