- Home /
Question by
Doomky · Mar 05, 2017 at 03:28 PM ·
networkingmultiplayernetworkspawnserver
Network client : cannot fire
Hi i'm new to Unity and i have a problem with my network. I'm working on player's script. This script is working for the host but I don't understand why the client's player can't fire.
To sumup my script:
public class Player_Controller : NetworkBehaviour
{
[Header("AttackArea")]
[SerializeField] GameObject attackArea;
void FixedUpdate()
{
if (Input.GetKeyDown(KeyCode.Space))
{
CmdAttackSpawn();
}
}
[Command] void CmdAttackSpawn()
{
var gameObject = Instantiate(attackArea, transform.position, transform.rotation) as GameObject;
NetworkServer.Spawn(gameObject);
}
}
As you can see he's pretty similar to the one which is in tutorial section.
I'm on Unity 5.5.0f3 and I have this problem with the NetworkManager : link text
Is this error the origin of the problem?
PS: I just noticed that when the client is connecting to the server i have an error: InvalidOperationException: out of sync
Comment
Your answer
Follow this Question
Related Questions
Unity networking tutorial? 6 Answers
What is the CCU of the default Unity Networking? 1 Answer
Help with server creation and handling. 0 Answers
Seperate server - client 2 Answers
Networking Player Nametag 1 Answer