An input question

Here's my code.
public override void OnSyncedInput()
{
bool isshoot = Input.GetButtonDown("ok");
TrueSyncInput.SetBool(2, isshoot);
}
public override void OnSyncedUpdate()
{
if (TrueSyncInput.GetBool(2) == true)
{
Debug.Log(gameObject.tag);
}
}
There's two players in the game.When I press the "ok"button once,in local client ,the "Debug.Log" executes once,but in another client ,the "Debug.Log" ALWAYS executes twice.That's confusing.Is it the problem of my code?or it is a bug?

Comments

  • More accurately,in local client ,the "Debug.Log" executes once in high probability(sometimes doesn't execute,that's easy to understand).But in another client,the number of times of executions always goes wrong(always twice,sometimes triple,somestimes once)Why is it different in two clients?Is it possible to improve the situation?
  • Hello @kidd5368, this could be because of rollbacks. If you have a rollback window it means you enabled the rollback mechanism that can go back to a old frame to resimulate frame and be sure both clients have the same final state. A different number of logs doens't means the game simulation is wrong at the end, it pretty common when you have rollbacks.
Sign In or Register to comment.