Moving Gamewindow causes change of the variables

So on the screenshot you can see the window is at arrow 1 and arrow 3 shows that his height is 2.3 because he jumped. When i move the gamewindow to arrow 2 he only jumps 1.3??? And he seem to move slower too but not sure about it and idk how to find it out

The Jumping Script

        RaycastHit hitInfo;
        onGround = Physics.Raycast(transform.position + (Vector3.up * 0.1f), Vector3.down, out hitInfo, 0.12f);
        anim.SetBool("onGround", onGround);
        if (Input.GetAxis("Jump") > 0f && onGround)
        {
            Vector3 power = rigid.velocity;
            power.y = jumpPower;
            rigid.velocity = power;
        }
        rigid.AddForce(new Vector3(0f, extraGravity, 0f));

This is just a small thing but it bothers me so hard. I am totally new to Unity. Everyone trying to help me i appreciate you very much!

This most likely means your code is framerate dependent. In other words it behaves differently at different framerates. Your framerate is changing because you’re changing the resolution of the game.

Is this code inside Update()? Doing physics operations inside Update is a common source of framerate dependence in scripts. You must do all physics operations inside FixedUpdate, and read input inside Update.

I had this code inside Update() now it is in FixedUpdate() and it works!! Thank you very much :slight_smile: