I’m using timer inside my blueprint dervied from Uobject. Inside Actors I can call KismetSystemLibrary’s function called ClearAndInvalidateTimer(K2_ClearAndInvalidateTimerHandle) when I don’t want that timer anymore. In UObject number of functions from KismetSystemLibrary is reduced. There is only Invalidate function (K2_InvalidateTimerHandle) but it does not cancel execution of function from timer. It just messes up FTimerHandle passed as argument.
So 2 questions:
- How to properly clear timer inside Uobject?
- Is there any reading about how scope of blueprint functions work? Why in some blueprints I can use functions from BlueprintFunctionLibrary and in some I can’t?
Thanks in advance!
So I did some research and founded this pull request. Basically BlueprintLibraryFunctions got this weird desing where they need world context object to get world from. Uobjects arent necessarly inside any world so thats why you cant use some of the functions. So what you can do is use cpp and override GetWorld() function. I solved it with bp. I did something like dependency injection. I passed actor based class to my uobject. This actor based class got function that takes timer handle as a parameter and then calls clear and invalidate timer for my uobject from actor.
Here is link for pull request - keep in mind that you need access to ue4 source code on github
[https://github.com/EpicGames/UnrealEngine/pull/5652](https://Github link with pull request to blueprint function library so it can be used with uobjects)