Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Setting Fixed Timestep (Project Settings) by script?

Discussion in 'Scripting' started by Axel-F, May 15, 2014.

Thread Status:
Not open for further replies.
  1. Axel-F

    Axel-F

    Joined:
    Mar 20, 2009
    Posts:
    223
    Hi,

    I wonder if the "Fixed Timestep" value in the Project Settings section (Edit => Project Settings => Time) can be altered by script? I would like to change this value so it fits the currents (mobile) device hardware capabilities.

    Thanks!

    Regards, Axel
     
    Tymianek and hopetolive like this.
  2. GarthSmith

    GarthSmith

    Joined:
    Apr 26, 2012
    Posts:
    1,240
    Code (csharp):
    1.  
    2. // Sets to 20 fps
    3. Time.fixedDeltaTime = 0.05f;
    4.  
     
  3. wechat_os_Qy0-uGXFkXao9GPrGtzQ0xzyk

    wechat_os_Qy0-uGXFkXao9GPrGtzQ0xzyk

    Joined:
    Apr 6, 2020
    Posts:
    1
    THANKS!!
     
    Imm0rt4l_PL and Azurne like this.
  4. PanicEnsues

    PanicEnsues

    Joined:
    Jul 17, 2014
    Posts:
    187
    On a related note, any way to change the "Maximum Allowed Timestep" value by script at runtime?
     
  5. PanicEnsues

    PanicEnsues

    Joined:
    Jul 17, 2014
    Posts:
    187
    In answer to my own question, "Time.maximumDeltaTime".
     
  6. Kritankboy

    Kritankboy

    Joined:
    Aug 8, 2020
    Posts:
    15
    Do you know if this changes the maximum allowed timestep globally (for every scripts) or locally (for the script it's mentioned in)?
     
  7. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,520
    Time
    is a global static class, as you can see from the online documentation for it.
     
    Kritankboy likes this.
Thread Status:
Not open for further replies.