AI Spawning Loses Functionality

I have an NPC blueprint which has a follow function. When I drop him into the scene, he follows perfectly. However, when I spawn him into the scene, his AI movement stops working. According to all of my print strings, its firing off perfectly, but he isn’t physically moving to follow the player. This seams to be a problem whether its an event tick like I have it set up now, or as a custom event. The result is the same. Has anyone else had this issue?

Hi.

It’s not a good idea doing something like that using tick. Instead, use Behavior tree.

As for the AI not following you there can be different reasons, such as:

AI is not possessed;
AI is not on a NavMesh;
Or on a different NavMesh with no proxy connecting it with one, that you on.

For debugging AI, you can press [ ’ ] button.

I appreciate the help, but I actually started with a behavior tree and switched to the tick because I was encountering the same problem. The character follows perfectly when he’s dropped into the scene, but not when he’s spawned.

Spawn AI, press [ ’ ], make screenshot, post it here.

Do the same but with placed AI

There is no specific placed AI, it is an character that is being placed. That character there that says “NoController” over his head is the issue in question.

So AI that is placed don’t have NoController next to the name?

Right. When I drop him into the scene his controller is present. When he’s spawned in, it disappears. No matter what I do, I can’t reset the controller. I’ve tried having it set on spawn, set on interact, nothing works. He simply doesn’t have a controller when he spawns. When I perform print strings within the functions, every node is firing, but he isn’t moving. I’m baffled by this.

show ai spawning code

In your AI Pawn’s Class Defaults,
image

Set Auto Posses AI to “Place in World or Spawned” instead of Placed in World :
image

I don’t know why it’s not the default, everyone seems to miss it.

Oh yeah… forgot about that.

Thank you! I was going insane!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.