- Home /
Movement speed of player is much slower in build than in the editor
So I'm making a small runner game where the player can only move up and down to avoid obstacles.
When in the editor within unity, the player moves at the correct variable of speed of 175; yet when select file>build&run, the player moves a lot slower (at about 100) while the rest of the level moves at the correct speed.
I have no idea what could be causing this. I've tried resetting the player to the prefab, i've tried rebuilding it, i've tried reloading unity and i've tried editing it in the inspector and none of it has worked.
It's like this on all computers I try it on
public float movementSpeed = 175f;
private Vector3 movement = Vector3.zero;
CharacterController playerMovement;
void Start ()
{
playerMovement = GetComponent<CharacterController>();
movementSpeed = 175f;
}
void Update ()
{
movement = new Vector3 (0, Input.GetAxis ("Vertical"), 0);
movement *= (movementSpeed) * Time.deltaTime;
playerMovement.Move(movement * Time.deltaTime);
}
an example of the code.
If you can help at all, I would be greatly appreciative. This has been driving me mad
(I'm not the greatest programmer ;_; )
Answer by MD_Reptile · Mar 17, 2017 at 02:48 AM
Your multiplying by delta time twice.
Do it once.
You are amazing. I can see exactly how I was doing it wrong now.
Thank you so so much!
In addition , you can multiply it with Time.fixedDelatime for a far more accurate :)
Answer by elijahjns · Sep 12, 2020 at 03:07 AM
I'm pretty sure I'm doing it only one but I'm having the same issue. So are other people.
Answer by lelegepa · Jun 03, 2021 at 09:47 PM
Had the same problem. I put all my movement into: void FixedUpdate() I'm an amateur but hopefully this helps someone.
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Unity to android (game very laggy) 1 Answer
Pros and Cons of Lightmapping 1 Answer
Do "Dynamic Public Strings" effect iPhone Performance? 1 Answer