Host can send ServerRPC but Clients cant
using Unity.Netcode;
using UnityEngine;
public class NetwrokRpcTest : NetworkBehaviour
{
public override void OnNetworkSpawn()
{
if(!IsOwner) Destroy(this);
}
void Update()
{
if(Input.GetKeyDown(KeyCode.M)){
testServerRpc();
Debug.Log("Key pressed");
}
}
[ServerRpc]
void testServerRpc(){
Debug.Log("Hello world");
}
}
as Host:
as a Client: