Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

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

Discussion in 'Scripting' started by Kinkku2, Jun 5, 2015.

  1. Kinkku2

    Kinkku2

    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:
    373
    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. Kinkku2

    Kinkku2

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