I'm a doctor, not a mechanic

Timing

From Unreal Wiki, The Unreal Engine Documentation Site
Revision as of 07:38, 31 August 2011 by WGH (Talk | contribs) (moved SetTimer to Timing: I've suddenly noticed that SetTimer is not the only timer-related function)

Jump to: navigation, search


SetTimer is a function that sets a timer to call the given function at a set interval.

Here is function declaration from UT3:

function SetTimer(
    float inRate, 
    optional bool inbLoop, // not optional in UT2004
    optional Name inTimerFunc='Timer', // doesn't exist in UT2004
    optional Object inObj // doesn't exist in UT2004
);
  • inRate - time interval, in gameplay seconds. If inRate <= 0.0, it'll reset the timer.
  • inbLoop - if false, it'll fire only once. Default to false.
  • inTimerFunc - function name.
  • inObj - an optional argument to pass to that function. Timer doesn't take any arguments, so it's usable only with custom functions. As a side note, this argument is never used in UT3.

How to make seconds real

Multiply rate by WorldInfo.TimeDilation. Of course, this method isn't absolutely reliable, as TimeDilation may change before timer fires.

See also