AI not working in Development/Shipping Build

I have a custom AI character set up using AI Perception. The game works perfectly fine when i PIE, but when I build the game, None of the AI characters move. I know it isn’t a NavMesh issue, because when the AI sees the player, It actually switches to “chase” state and follows the player.

When I turn on AI debugger, and Perception visualiser, It doesn’t seem to be the correct radius and it’s located at 0, 0, 0.

Is there any additional setting or option before building?

1 Like

Make sure your AI possession rules are correct.

In the Pawn class defaults, check out possession rules: “Placed in world”, “Spawned” or “Both”. Set it to “Both”.

I set it on “Both” but it still doesn’t work. I don’t think it’s a possession issue, cuz the AI does react to Stimulus from the Player.

Is any of the components / functions used by your AI contained in a plugin?

Is the plugin properly added to the list of dependency modules in your Target.cs cpp file (if you have one)?

If you have plugin components and no cpp file including it, I suggest your create a blank cpp class just to generate a Target.cs file in order to include your plugins.

I’m not using any plugin in my project. Also it’s all blueprints, I know nothing about cpp. I came across this post which claims that “Get Blackboard Value as…” doesn’t work in dev/shipping build.

https://answers.unrealengine.com/que…but-not-s.html

Not sure how else to get blackboard values in Blueprints if that is actually the case

I have no leads anymore.

You need to find out what is the problem in order to know how to fix it.

To find this out you have to isolate systems from one another and gather feedback about the state of your logic to understand what is causing the issue.

To me, you need to add print strings to your logic and enable it in your build (to enable it simply built in Development mode, which should be your default build mode anyway I suppose).

Add a print string that triggers whenever pawn sensing is updated.
Deactivate anything but movement, then pawn sensing, then attacking or whatever logic you have. I’d suggest to deactivate everything but the pawn sensing and movement logic, to see if anything you just deactivated was actually preventing it from working as it should.

I also need more information about the behavior you’re expecting to have and the behavior you’re actually getting right now.

Yeah, im going to step back and debug each state from the beginning. Looks more like a logic issue. Will share updates as i go. I pretty much followed the Advanced AI course on Pluralsight. But their project too works in PIE mode.

I haven’t been able to find the actual issue, but I did notice that after the AI character sees the player and chases and attacks it, it actually goes back to the patrolling state and works normally as expected. It looks like there is something just stopping them from working when the level is loaded. I tried removing the Idle state all together so the AI starts off at Patrolling. And the debug info shows that it is in the Patrolling state, but they just don’t move.

Actually I just noticed that AI Perception doesn’t work at all in the build.

Am I the only one having trouble getting AI Perception to work in a built game?

2 Likes

So, small update on the AI character not moving. The Auto Possess Pawn rule doesn’t seem to work with “Placed in World” when I build the game. I tried spawning the enemy AI class in the level, and that worked fine in the built version. But I’m still having trouble getting AI perception component to work

Hey, did you find the solution? I’m having the exact same problem, except for me it doesn’t even show up, but the spawn sensing works.

Yeah, managed to get it working. Make sure you disable “Blueprint Nativization”

Thanks for that. Can you guess what was my error? I didn’t set the collision when spawning from default to something else. And default doesn’t include anything at all.

I was having the same problem, and setting “Auto Register as Source” in the AiPerceptionStimuliSource seemed to fix the problem for me. I’m not entirely sure if this breaks anything, but hopefully, this works.

Can\t beleive this is still happening in 2024 for me and i can’t figure out how to fix?