Help!My commands seem lost!
Hey,I'm new to PUN and I just write a very simple example using command.
But I find it must be something wrong.
My example's code like this:
when I run the scene locally(The server and the client are all in my computer),
I press key J in client , if I see the log in the server side ,it means that the server receive the command ,right?
But when I press J in client,it seems there are 90% probability to lose the command.It only print 1/10 logs in server side.
But I find it must be something wrong.
My example's code like this:
public override void SimulateController()
{
base.SimulateController();
if (Input.GetKeyDown(KeyCode.J))
{
IPlayerInputKeyDownInput input = PlayerInputKeyDown.Create();
input.keyType = 1;
entity.QueueInput(input);
}
}
public override void ExecuteCommand(Command command, bool resetState)
{
if (entity.isOwner)
{
Debug.Log("Excute Command " + command);
}
}
when I run the scene locally(The server and the client are all in my computer),
I press key J in client , if I see the log in the server side ,it means that the server receive the command ,right?
But when I press J in client,it seems there are 90% probability to lose the command.It only print 1/10 logs in server side.
0
Best Answer
-
Finally soved the problem.
I should not use Input.GetKeyDown(KeyCode.J) in SimulateController.It should be in Update.
0
Answers
-
Finally soved the problem.
I should not use Input.GetKeyDown(KeyCode.J) in SimulateController.It should be in Update.
0