Exporting Framerate

From ETC Public Wiki
Jump to: navigation, search

Overview


The Update function runs every frame, and not all the computers have the same frame rate. To make your game run at the same speed regardless of frame rate, adjust the speed of dynamic actions using Time.DeltaTime (ie, multiply them by Time.DeltaTime).

Time.DeltaTime


Delta time is the time it took (in seconds) for Unity to complete the last frame. More explanation

void Update() {
       
       float translation = Time.deltaTime * 10;
       transform.Translate(0, 0, translation);
 }