I’m having trouble figuring out how to get the path status result for my AI character’s path, and then using it as a condition. The main class I’m working with is the “UPathFollowingcomponent” class.
For example, in the C++ documentation there is an “Enum” called “EPathFollowingStatus::Type”. With members like idle, waiting, moving, etc…
How can I get which state the AI character is in (on the path I guess), and then use that state in a condition? Here is my code snippet (which does not work currently):
if (AIInstance1->GetPathFollowingComponent() != nullptr)
{
UPathFollowingComponent* PFComp = AIInstance1->GetPathFollowingComponent();
if (PFComp != nullptr)
{
EPathFollowingStatus::Type thePathStatus1 = PFComp->GetStatus();
if (thePathStatus1 == EPathFollowingStatus::Moving)
{
useOnce1 = false;
}
else
{
useOnce1 = true;
}
}
}
The UE4 editor simply crashes when it hits the " if (thePathStatus1 == EPathFollowingStatus::Moving)" condition. What am I doing wrong?
I should add, what I’m aiming for is getting the current path status, seeing if my character is currently “Moving”, and do logic from that condition.