So in my game I am trying to make my character dash a fixed distance in the left or right direction depending on the input. I have use a lot of print statements to debug and it has all boiled down to one issue.
void FixedUpdate() {
if (Input.GetKeyDown(KeyCode.LeftArrow))
{
print("hi");
myRigidBody.MovePosition(myRigidBody.position + (Vector2.left * speed * Time.fixedDeltaTime));
}
}
Sometimes hi prints 170 times and at other times it prints 140 times. Could someone fill me in on what is going on here?
Does every frame take a different amount of time to complete?
How am I suppose to make an object always dash a fixed distance in a fixed amount of time?