Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Maximize On Play

Discussion in 'Editor & General Support' started by noobator9318, Sep 24, 2020.

  1. noobator9318

    noobator9318

    Joined:
    Sep 24, 2020
    Posts:
    1
    Hello,

    When my scene is executed, I get different results between the normal interface and the "Maximize on play" mode. For example, I have an object moving downward at a speed of -0.01f. Now, in the animation played in the interface, the object takes about 6 seconds to reach its final position. On the other hand, this same object in "Maximize On Play" mode takes about 2 seconds (much faster) to descend. The same goes for other objects. Any suggestion on how to resolve this apparent discrepancy.

    Thank you
     
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,697
    You probably have some framerate-dependent movement code. When the game is maximized, the resolution is higher, and you probably have a slower framerate (and therefore, slower movement speed).
    Since you didn't say "per second" here, I assume you mean "per frame", which would make sense with what I said above.

    The solution is to define your movement speed as "units per second", and multiply that speed by Time.deltaTime when determining the distance to move in a single frame.
     
    Vryken likes this.