forked from Harrison1/unrealcpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTimerActor.cpp
More file actions
24 lines (19 loc) · 701 Bytes
/
TimerActor.cpp
File metadata and controls
24 lines (19 loc) · 701 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Harrison McGuire
// UE4 Version 4.20.2
// https://github.com/Harrison1/unrealcpp
// https://severallevels.io
// https://harrisonmcguire.com
// helpful link
// https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/FTimerManager/SetTimer/4/
#include "TimerActor.h"
// Called when the game starts or when spawned
void ATimerActor::BeginPlay()
{
Super::BeginPlay();
// connect timer function to actor. After 5 seconds run RepeatingFunction every 2 seconds
GetWorldTimerManager().SetTimer(MemberTimerHandle, this, &ATimerActor::RepeatingFunction, 2.0f, true, 5.0f);
}
void ATimerActor::RepeatingFunction()
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Hello Timer"));
}