I’m making a platformer and it is vital that the speed remains constant…Currently I use
void Update()
{
transform.position = new Vector2 (transform.position.x + (Speed * Time.deltaTime), transform.position.y);
}
For the past week or so it was working fine, but recently when I test the level it will lag for the first 3 seconds or so (Im unsure why) and then whether it continues to be going at a constant speed appears to be random. Ive tried alot of methods and the more I research the more I realize that this method should be perfect…or at least not more than a few milliseconds different each playthrough.
So is there even a way in which speed will be constant regardless of lag? Or is this method correct, and It just appears to be lagging in some weird way for me?(If it is a problem with my computer, any clue on why it is only lagging recently and not the past couple of weeks?)