Search Unity

Character speed slows down a lot when the resolution is bigger in the editor

Discussion in 'Scripting' started by matias-e, Jun 5, 2015.

  1. matias-e

    matias-e

    Joined:
    Sep 29, 2014
    Posts:
    106
    Hey, I have a bit of a problem. I have a basic 2D sidescroller game where my character moves left and right + has the ability to jump. When my resolution is small, the character moves totally normally but when I press 'maximize on play' the character's speed slows down by a huge amount. He basically turns into a snail.

    Does this have something to do with the elements scaling up with resolution or what could be the cause? When I jump, I think the character moves at its normal speed no matter the resolution.
     
  2. lordconstant

    lordconstant

    Joined:
    Jul 4, 2013
    Posts:
    389
    Are you doing something similar to this:

    Xpos += 5; //right

    As if you are you should be doing this:

    Xpos += 5 * Time.deltaTime;

    This way your movement code is frame independent.
     
  3. matias-e

    matias-e

    Joined:
    Sep 29, 2014
    Posts:
    106
    Ah, I'm indeed not linking it to time. Thanks man!