Struct: FMetronome
struct SYSTEMS_API FMetronome;
Reflection-enabled
Specifiers:
- BlueprintType
- Blueprintable
Metronome for ticking optimizations.
Useful for spreading tickable work across time. User should use it to limit number of heavy ticking operations that do not need to perform on every tick, rather can be executed with uniform random time offset for each instance of a group. Good usecase would be AI tasks.
Example
auto Metronome = FMetronome{};
Metronome.Progress(10.0);
if (Metronome.ConsumeTicked())
{
UE_LOG(LogTemp, Warning, TEXT("Metronome ticked!"));
}
Properties
-
Accumulator
public: float Accumulator;
Reflection-enabled
Specifiers:
- EditAnywhere
- Category = Systems|Metronome
Tells the current time phase.
-
Limit
public: float Limit;
Reflection-enabled
Specifiers:
- EditAnywhere
- Category = Systems|Metronome
Tells the time limit that marks time of ticking.
-
bTicked
public: bool bTicked;
Reflection-enabled
Specifiers:
- EditAnywhere
- Category = Systems|Metronome
Tells if metronome has ticked.
Methods
-
ConsumeTicked
public: bool ConsumeTicked();
Chechs if metronome ticked and consumes
FMetronome::bTicked
(sets it tofalse
). -
Progress
public: void Progress( float DeltaTime );
Performs
FMetronome::Accumulator
accumulation byDeltaTime
value.
Arguments
-
DeltaTime
float DeltaTime
-
-
Randomize
public: void Randomize();
Tries to uniformly randomize
FMetronome::Accumulator
value in range from 0 toFMetronome::Limit
.
Documentation built with Unreal-Doc
v1.0.8 tool by PsichiX