How to uses Timers in Blueprint Function Library

I wrote a Blueprint Function Library with a function i want to be called every 5 seconds.

I want to start and stop the timed execution with 2 wrapper functions:

CLASS()
class URemotelabInterface : public UBlueprintFunctionLibrary
{
	GENERATED_BODY()
	
public: 
	static void callMeEvery5Sec(){ /*doSomethingHere*/ };
    UFUNCTION(BlueprintCallable, Category = "MyBPFunctionLib")
	static void startTimedExecution(){ ????? }
    UFUNCTION(BlueprintCallable, Category = "MyBPFunctionLib")
	static void stopTimedExecution(){ ????? }          
}

As far as I know the timer functions is only available inside AActor classes and can only be called in a non-static context. In a blueprint function library I do not inherit the AActor class and have to access the timer from a static function.

Is there any possible way to implement it as i want to? Or is there a workaround?

greetings

You should implement the actual timer in your game mode. In the blueprint library you can cast the currently active game mode to your class and call the methods there.

I solved it in a different way now: I used the ‘Set Timer by Event’ Blueprint node. And registered a Custom Event calling my Function there.

But your way seems to be cleaner. Thanks for the help!