Search Unity

Basic question re: fixed update

Discussion in 'Getting Started' started by kidmethuselah, Apr 7, 2021.

  1. kidmethuselah

    kidmethuselah

    Joined:
    Jan 14, 2021
    Posts:
    18
    Hi,

    Is there an equivalent to FixedUpdate that works when time.timescale = 0?

    I have a function that currently executes in Update, which means it sometimes goes quicker/slower depending on framerate. I need it to happen at a fixed rate. The obvious solution would be to execute the function in FixedUpdate, but at the time the function occurs, time.timescale is set to 0.

    (I have tried googling this but I can only find threads where people are asking the opposite question (how can I make things stop happening when time.timescale = 0))

    Thanks!
     
  2. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,512
    There's not a built-in alternative for having scaled time work when your timeScale is set to 0, no. You'll have to use your own time-keeping object to handle working with objects that need updated at a fixed rate when you've messed with the fixed time.
     
    kidmethuselah likes this.