Time Macros - Epic Wiki

# Time Macros

# Contents

# Overview

Convenience macros for creating and working with values based on GetWorld()->GetTimeSeconds().

# YourProject.h

#define TIMENOW (GetWorld() ? GetWorld()->GetTimeSeconds() : 0.0f) #define TIMESINCE(Time) (GetWorld()->GetTimeSeconds() - Time)

# Examples

# Actor Tick

# SomeActor.h

protected: float SomeTime;

# SomeActor.cpp

void ASomeActor::Tick(float DeltaSeconds) { Super::Tick(DeltaSeconds);   if (TIMESINCE(SomeTime) >= 1.0f) { SomeTime = TIMENOW; DoSomething(); } }

# Credits

Kris

Retrieved from "https://wiki.unrealengine.com/index.php?title=Time_Macros&oldid=14093"

Category: