So if you have a delay in a behavior tree task, and then the task is aborted, or finishes, the delay will actually still fire and trigger things.
Surely this is a bug? Shouldn’t inactive tasks be, well, inactive?
So if you have a delay in a behavior tree task, and then the task is aborted, or finishes, the delay will actually still fire and trigger things.
Surely this is a bug? Shouldn’t inactive tasks be, well, inactive?
This is actually an engine bug that I came across a couple weeks ago. Epic is aware of it, and they say it will be coming in a coming 4.8 update.
Are you building C++ for your project? If so, Mieszko from Epic gave me the following fix for the function FLatentActionManager::ProcessLatentActions (in LatentActionManager.cpp). Replace the piece of code that looks very similar to the chunk below:
for (FActionsForObject::TIterator It(ActionsToRemoveMap); It; ++It)
{
auto ActionList = GetActionListForObject(It.Key()); // Here was the bug! Passing in It.Key() fixes it.
auto ActionToRemoveListPtr = It.Value();
if (ActionToRemoveListPtr.IsValid() && ActionList)
{
for (auto PendingActionToKill : *ActionToRemoveListPtr)
{
const int32 RemovedNum = ActionList->RemoveSingle(PendingActionToKill.Key, PendingActionToKill.Value);
auto Action = PendingActionToKill.Value;
if (RemovedNum && Action)
{
Action->NotifyActionAborted();
delete Action;
}
}
}
}
ActionsToRemoveMap.Empty();
Or just hold tight for that update!
By the way, a side effect of this same bug was that some random delay somewhere else in the running game was likely being silently canceled.