Pawn will not move on spawn even when Auto Possess AI is set to "Placed or Spawned"

I am having a hard time finding my way though this current issue. I have a simple enemy pawn using Simple Move to Actor (I have also tried AI Move To Location or Actor) which works when placed in the world manually, but not when spawned.

I have looked up a wide array of fixes since this seems like a common problem with a generally simple solution. However none of the solutions have worked for me. Currently the class details have “Auto Possess AI” set to “Placed in World or Spawned”, and the Controller is set to “AIController”. I saw some info that spawning the pawn does not automatically assign a controller so I have put, “Spawn Default Controller” in the script that spawns it (using the specific object reference), the construction script, the Event BeginPlay, and even the Event Tick as a Do Once. I have tried to set AI Controller Class, and have tried a few custom AI scripts to see if something else would work and nothing appears to be functioning.

Try changing the spawn transform. It’s very common for it to attempt to spawn characters 1-2 unreal units below the surface of the ground. When this happens, the character isn’t able to move due to collision.

Another thing, and I’m sure you’ve likely checked this; but make sure that the spawn coordinates place the character within the navmesh or it won’t be able to accomplish any movement.

Attaching the default Controller should not be needed when you’ve set PlacedInWorldOrSpawned in Auto Possess AI class details.
Try the node SpawnAIFromClass.
Try and add a “Target Point” to your level with a save spawn location and try to use its location for the spawn - just to be sure. Check the Nav Mesh (Press P in Editor). Also I’m not sure if the move to in TICK is a bad location…I guess it is - but I’m wondering when you say it works when you put the actor manually into the level.
Also start play, eject with F8 and compare the manually placed and the spawned actor in the world outliner

1 Like

@ArdentCoder did it work?

I haven’t had a chance to jump back into that project yet. I will definitely post here with the results.

Sorry for the delay, I was out of state. I just got back and tried some options along these lines. I swapped to SpawnAIFromClass and tried spawning it at the generated location (my current method) and with the same location values as when I place one manually in level. As before, manually placed ones pursue the player immediately, but the one spawned by script stood still whether placed by the script or by a set location based on the manually placed one’s location details. Since this is a VR project it wont let me eject but I was able to compare the outliner details and the properties seemed the same, along with z height.

Edit: I changed the script to “GetRandomReachablePointInRadius” as a navmesh trace and use that as the location and even tried changing the actor it was targeting and that still had no effect.

Below is the Blueprint of both the manually spawned AI_0 and Script Spawned AI_1 showing that they have the same controller type and target.

At least as far as I can see it seems to continue ignoring the AI MoveTo, I have tried using the same location data as the ones place manually, manually setting z-height and so on but it doesn’t appear to affect it, while those manually placed in the level continue to act properly.

Edit: I changed the script to “GetRandomReachablePointInRadius” as a navmesh trace and use that as the location and even tried changing the actor it was targeting and that still had no effect.

It’s hard to help from this. Can you Share the Project? Can you use the gameDebugger? It has good AI Debugging Integration. You can Launch it by Default in a running Game with the apostrophe Key I think

I will see what I can pull together. I may not be able to send the project but I will try and get some debugging info and maybe attempt to create a clean project with the same scripts and see if they act the same way.

Let me know if this is a usable format for sharing the project, this is the first time I’ve posted project files. Google Drive Download This is a new demo project with a First Person Character and some dummy AI’s using the same script setup. There are several AI’s placed manually, and you can spawn AI’s by pressing Q which searches for a reachable space on the NavMesh, pressing E activates the AI move to scripts which only works on the pre-spawned AI’s.

I placed the AI’s manually at different levels above the navmesh which did not seem to effect their ability to pursue the player.

The map file can be found in the VirtualRealityBP > Maps folder (Motion Controller Map) but it wont require a VR setup.

Great I’ll have a Look Into it later

hm…somehow the zip is corrupted. it doesn extract me the level…I play around with it and try my best :wink:

@ArdentCoder sorry, I forgot about the ticket. I had a look at your project files, you need to possess the pawn with the controller, like so:

289189-1.png

The spawnDefaultController is optional if you have not set the Pawn Autopossess AI to “Placed or Spawned”

If these things dont work ( they didnt for me ), what worked for me was to put a 1 second delay on the begin play node in my Enemy Spawner. Hope that helps if nothing else does!

1 Like

SpawnAIFromClass really works. Thanks a lot!