In the Unreal docs for the state machine Node Functions, it mentions specifically that “Although we do not recommend it, you can disable this behavior so that Functions execute on the game thread by disabling Thread Safe from your selected Function’s Detailspanel.”
I tried disabling the Thread Safe for my state machine node’s `OnStateEntry` Node Function per the documentation, but I now get the error “State Entry function is not thread safe Output Animation Pose”.
[Image Removed]
Is the documentation only referring to disabling thread safety for normal Animation Blueprint Functions (not Node Functions)? We have non-threadsafe code (broadcasting a delegate from the ABP) that we need to call on the state’s enter/exit Node Function, while keeping the rest of the ABP using the multi-threaded animation update.
Is the only path forward to call non-threadsafe code for state enter/exit to use the old `EnteredStateEvent` that allows for creating a notify custom event on the EventGraph? We’d rather not go that route, since those are referred to only by function name, and are very brittle if someone renames the event.
Steps to Reproduce
In the Unreal docs for the state machine Node Functions, it mentions specifically that “Although we do not recommend it, you can disable this behavior so that Functions execute on the game thread by disabling Thread Safe from your selected Function’s Detailspanel.”
I tried disabling the Thread Safe for my state machine node’s `OnStateEntry` Node Function per the documentation, but I now get the error “State Entry function is not thread safe Output Animation Pose”.
[Image Removed]
Is the documentation only referring to disabling thread safety for normal Animation Blueprint Functions (not Node Functions)? We have non-threadsafe code (broadcasting a delegate from the ABP) that we need to call on the state’s enter/exit Node Function, while keeping the rest of the ABP using the multi-threaded animation update.
Is the only path forward to call non-threadsafe code for state enter/exit to use the old `EnteredStateEvent` that allows for creating a notify custom event on the EventGraph? We’d rather not go that route, since those are referred to only by function name, and are very brittle if someone renames the event.
Unfortunately, those state events are the only method for handling this particular case. Those events are called using a deferred method to manage thread safety, and we can’t call other functions in a deferred way. The only way to have those node functions run your non-thread-safe function is to run the whole graph unthreaded. That could have substantial perf issues though.
Is the documentation only referring to disabling thread safety for normal Animation Blueprint Functions (not Node Functions)?
Correct, this is mostly regarding functions that need to run in the Bluepring Thread Safe Animation Update event. In general, if something touches the anim graph, it really wants to be threaded; if it’s in the event graph, it runs just before or after the threaded update.
Unfortunately, I don’t have a good workaround for this (code suggestion), but I was talking to the dev team about your concern. We’d rather not go that route, since those are referred to only by function name, and are very brittle if someone renames the event. One suggestion I made was to consider changing these to the custom event bindings UX, allowing you to ensure safety and access those events more quickly. It’s not guaranteed, but that is something that your team could look into instead.
Lastly, in 5.7, those state events have been marked as deprecated. After talking with the dev team, this feels unintentional because of the functionality we’re discussing here. I expect that should be corrected in a future update.
That makes sense that the new Node Functions within the states are threadsafe only. Making the whole graph not use threadsafe update isn’t an option for us, and it wouldn’t be a good tradeoff just to get this one bit of functionality.
Your suggestion to make the older name-based “Animation State” events on FSM states and transitions use the new “custom event bindings UX” with the support for rename and the function picker seems like the best option.
And I also echo your concern that having the old notifies marked as deprecated is concerning (given it’s the only way to call non-threadsafe code now), especially since it’s inconsistent right now. See the image below - the “Animation State” events on the nodes are marked with the yellow exclamation point, but the Transition “Notifications” are not.