I have a method decorated with the meta BlueprintThreadSafe and BluprintPure which i would like to use in the state transition node on the anim blueprint. However unreal still gives a warning that it is not thread-safe. i call it on a component of the character. The reference to this component is aquired in the event graph of the anim blueprint. Although the blueprint warning points to the method GetCoverComponent as non thread-safe, it doesn’t do so if i only read a value of a variable from the same component.
can confirm, it does not work for us either in 4.18.2. I think it stopped working sometime at the end of last year, so it can be the update to 4.18.2 from 4.17 for us. Not sure in which version between 4.17 and 4.18.2 it broke, though.
According to Class Specifiers | Unreal Engine Documentation the meta tag BlueprintThreadSafe can only be used with functions in a Blueprint Function Library class, UBlueprintFunctionLibrary.
Those functions needs to be static to work.
Basically, this is all you need UFUNCTION(BlueprintCallable, BlueprintPure, Meta = (BlueprintThreadSafe), Category = “MyCategory”) and whatever else your function needs to be called with.
Only valid on Blueprint function libraries. This specifier marks the functions in this class as callable on non-game threads in animation Blueprints."
As everything that has a “Warning!” Label, Use with caution, Was having this issue in 4.2.6.2 following a tutorial on YT, Hope this helps another vigilant seeker, Happy Deving!
Can confirm this is still happening in Version 5.7 as well.
Pretty unfortunate that we are lacking such a simple yet fundamental meta specifier for UFUNCTION.
Can access UProperty via component reference just fine, but any const function is a no go all of a sudden? Ridiculous.
A naive approach is to do a tick cache version of the computed value in ABP event graph, and access that cached value in transition graph. And of course, if the flag is packed & networked, update cached value upon OnRepNotify event, saves the per tick calculation.
A more conceding approach towards current architecture is to create such a static function marked as meta BlueprintThreadSafe at funcLibrary, and pipe the raw data as an input to said thread safe lib function, and call that directly from transition graph.
If anyone knows a better approach, please let me know.