[SOLVED]Weird Input Handling problem

I have two players and a ball. Player can shoot if it is already colliding
with the ball by pressing "Jump" button but I am having a problem, only the client is shooting (synced), not the other player(masterClient). I don't know what is wrong because other inputs for moving the players are working properly. I am using
kickingheads demo as a base and handling input like below,

PlayerBehavior.cs public override void OnSyncedInput () { byte shoot = CrossPlatformInputManager.GetButton("Jump") ? (byte)1 : (byte)0; TrueSyncInput.SetByte(INPUT_KEY_JUMP, shoot); } public override void OnSyncedUpdate () { if (TrueSyncInput.GetByte(INPUT_KEY_JUMP) > 0 ) shootFlag = true; else shootFlag = false; } public void OnSyncedCollisionEnter(TSCollision2D other) { if(other.gameObject.tag == "ball" && shootFlag.Equals(true)){ //SHOOT HANDLING TSVector2 shoot = (other.rigidbody.tsCollider.tsTransform.position - tsRigidBody.position).normalized; other.rigidbody.AddForce(shoot * 1300); } }


  • Hello @Mr_Goldfinger, can you add a "[AddTracking]" attribute over "shootFlag" and test it again?
  • Ty for the answer and I tried but no luck with that. My rollback window is set to 0. It seems it triggers collision properly on both sides but this line never returns true on the second player's side because shootFlag never returns true but it catches tag condition just fineif(other.gameObject.tag == "ball" && shootFlag.Equals(true)){
    What's more weird is, when I disconnect from second player and remove that player, the masterClient starts shooting properly.
  • It resolved, it was my bad. The flag was a static variable. I don't know how it effected the process but removing the static property solved the problem. Thank you.
  • Nice @Mr_Goldfinger, good luck!