I am trying to call a function every 30 seconds. I have used this before without issues so I'm not sure why it isn't working now. Any ideas? Has something changed in 4.24 maybe?

.h I have tried both public and private

void Ping();

And the .cpp I see both logs in the output so I know its getting there. Also the ensure passes. I have also tried GetWorld which is null in a UObject and GWorld which also works but has the same problem of the ping function not being called at all.

UE_LOG(LogTemp, Warning, TEXT("start ping"))
if (ensure(GEngine))
    UWorld* World = GEngine->GetWorldContexts()[0].World();
    UE_LOG(LogTemp, Warning, TEXT("start ping has gworld"))
    World->GetTimerManager().SetTimer(PingTimerHandle, this, &UGameJoltApi::Ping, 30, true, 30);

And here is the ping function. Its not called even once. I never see the log in the output.

UE_LOG(LogTemp, Warning, TEXT("ping"))
FString Url = URLBaseApi + URLSessions + "ping/?game_id=460364&username=" + Username + "&user_token=" + UserToken;

TSharedRef<IHttpRequest> Request = FHttpModule::Get().CreateRequest();
Request->SetHeader("Content-Type", "application/json");
Request->OnProcessRequestComplete().BindUObject(this, &UGameJoltApi::OnStartSessionResponse);
  • 1
    \$\begingroup\$ Probably the world you get from GEngine is not the one currently in play. Can your UObject implement GetWorld by referencing its Outer? \$\endgroup\$
    – Rotem
    Feb 2, 2020 at 20:02
  • \$\begingroup\$ There isn't an outer AActor. Its just a lone UObject. I changed it to extend AInfo docs.unrealengine.com/en-US/API/Runtime/Engine/GameFramework/… so its an AActor and tried GetWorld() and the function still is never called. \$\endgroup\$ Feb 3, 2020 at 3:59
  • \$\begingroup\$ You dont have ‘;’ after the UE_Log - but that probably unrelated \$\endgroup\$ Feb 3, 2020 at 10:34
  • \$\begingroup\$ Also you have an initial delay of 30 secs - did you wait these 30 secs ? I would advice to remove the initial delay for the ease of debugging. \$\endgroup\$ Feb 3, 2020 at 10:36

1 Answer 1


I havent found an answer but I found a workaround. I moved the code in the UObject that starts the timer to my GameInstance and everything works as it should. I have no idea why I couldn't do this in the UObject but this is probably better design wise anyway as the API shouldn't have to worry about timers and such.

  • \$\begingroup\$ This is very strange - I have plenty o timers in UObjects - and they always worked :-| \$\endgroup\$ Feb 5, 2020 at 0:05
  • \$\begingroup\$ It is strange. I've never had problems with this before either. I'm curious if this is a change in behavior in 4.24. \$\endgroup\$ Feb 6, 2020 at 11:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .