Enemy AI doesn't work at all if spawned in AFTER the first half second of gameplay. The BT appears to work, but the pawns don't do anything.

I ran all my AI tests by “Placing in World” the actor and they work just fine. I also did some tests with spawning them in from an “Event Begin Play” node, and they still work just fine. Through a lot of trial and error I’ve found that (in my GameMode) if put a Delay node on the Begin Play and spawn them, they will work as long as the Delay isn’t greater than .5s.

If they are spawned after the first half second, then they just stand there and don’t move. When I look at the behavior tree while in game, it looks perfectly fine. I ran a test with one immediately spawned enemy and one spawned on a 2 second delay. The first worked fine and the second just stands still. The picture below is what the Behavior Tree looks like (for the broken AI). Nothing was failing, and the BT for the working AI is absolutely identical except for the value of “SelfActor”

Another odd thing I’ve found that can (potentially) fix the issue is getting rid of the intro animation pictured below. If I remove the Branch in the BeginPlay node and just go straight from the Set Variable → 0.1s Delay → AIBeginPlaying, then they all seem to work just fine. FYI the Intro Timeline is exactly 1s long.

What the heck is going on here?!? There shouldn’t be any changes in the GameMode or GameInstance around the .5 second mark, so why do they stop working if they’re spawned after that? Also, why does the Behavior Tree still appear to be working just fine when it most certainly is not?
Even if you don’t have an answer, let me know if you know of any more tests I can run to help figure this out.

Ezeon on reddit found the issue. The problem was changing the scale of the Capsule Component. Specifically at the beginning of the timeline when the scale was set to 0 which broke the physics of the Character Movement.

There are two solutions I found:

  1. My solution was to instead change the scale of the Sprite instead of the CapsuleComponent.
  2. Another solution that worked for me with the Capsule Component was to have the initial scale 0.05 instead of 0.0

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