Why does my character move faster in the emulator than when I export the project as a .exe?

I am working on my final project and it is completed, but I have the issue that when I export it, both my enemies and my character move much slower than during emulation and programming. The code that moves the character is the following:

if(Input.GetKey(KeyCode.W)){
                this.transform.position += new Vector3(0, movY, 0);
                //Damos los valores en la animación en caso de que pulsen las teclas
                animaciones.SetFloat("Vertical", 1);
                animaciones.SetBool("Movimiento", true);
            }
            
            else if(Input.GetKey(KeyCode.S)){
                this.transform.position += new Vector3(0, -movY, 0);
                animaciones.SetFloat("Vertical", -1);
                animaciones.SetBool("Movimiento", true);        

            }
            if(Input.GetKey(KeyCode.D)){
                this.transform.position += new Vector3(movX, 0, 0);
                animaciones.SetFloat("Horizontal", 1);
                animaciones.SetBool("Movimiento", true);          

            }
            else if(Input.GetKey(KeyCode.A)){
                this.transform.position += new Vector3(-movX, 0, 0);
                animaciones.SetFloat("Horizontal", -1);
                animaciones.SetBool("Movimiento", true);       

            }

If you’re doing this in Update(), then it works every frame → your movement speed is FPS dependant.
Why it is slower in a build? VSync?

Yeah i am doing this in Update(), do you have any idea how i can do it?

Maybe, can i disable it on build?

When you do this in Update(), it depends on the device FPS. For example, our game runs at 60 FPS on device A and 30 FPS on device B. According to your code, it will always move slower on device B than on device A. If you want to use Update(), multiply movY, movX by Time.deltaTime and this fixes the problem. Or you can do this in FixedUpdate(). I can suggest you to research the differences between Update, FixedUpdate and LateUpdate. You should also look at Time.deltaTime, Time.fixedDeltaTime.

Thank you very much, I will try it. The truth is, it makes sense, but I guess I hadn’t thought of it. Sorry for the inconvenience and thank you for the help.

1 Like