Hello I am upgrading my old network to the new unet.
The server is authorative server and doesn’t use any networkmanager. (What I mean is the input of a player goes to server, and server moves the character and send the input back to ALL players)
Right now it is working. I can listen the server.
Now I have problem at the character controlling part. Since it is an authorative server, the server owns all objects.
So I spawn it via NetworkServer.Spawn ( Client part is not finished ).
Now I have these function
[ClientRpc]
void RpcTest()
{
Debug.Log("Test");
}
[ClientRpc]
void RpcOnMovementCalled(Vector3 receivedMoveVelocity) {
networkReceiveMoveVelocity.x = Mathf.Clamp(receivedMoveVelocity.x, -1, 1);
networkReceiveMoveVelocity.y = Mathf.Clamp(receivedMoveVelocity.y, -1, 1);
if (nIdentity.isServer)
{
// we tell to clients they should update the position of the player first.
RpcOnSyncPosCalled(transform.position, true);
}
}
Both doesn’t get fired on the server. Example if I try to execute RpcTest() it doesn’t print anything in the console. How can I do it? I don’t want make duplicated functions. Are there alternates? ( Let us first just ignore RpcOnMovementCalled() )