AI Perception Not Updating Behaviour Tree Variables

Hi Guys,

Desperate for some help here I’ve been searching all afternoon to no avail.

I’ve been following the behaviour tree quick start guide (Behavior Tree Quick Start Guide | Unreal Engine Documentation) and have managed to get everything working except the first sequence allowing Line of Sight to be confirmed and for the AI to chase the player.

I’ve run some debugging and it looks like the AI is detecting the player as seen in the image, but it does not seem to be updating the Bool on the behaviour tree or allowing this branch to execute.

I have also double checked the spelling of the change by bool and keys on the blackboard and ensured that all components on my players blueprint have the ‘player’ tag.

Can anybody tell me what I’m doing wrong please? I’ve had a search through the questions already but couldn’t find an answer to assist.

Thanks in advance.

alt text

Ok my bad, I did not set the default value of the string variables I had only named them. Solved.

Hi,

(-) does the player pawn has the tag “Player”?

(-) what’s the name inside your “HasLineOfSite” key?

So inside your image “aiperception” can you do a print after OnTargetPerceptionUpdated, then one after True of the branch and then print “HasLineOfSite”?

I have also double checked the
spelling of the change by bool and
keys on the blackboard

It should be HasLineOfSight, so its written as Sight, not Site. Ofc if you everywhere have written it as Site then that won’t be an issue.

ensured that all components on my
players blueprint have the ‘player’
tag

The player pawn need to have this tag, so you can put it onto the components, but that won’t do anything here.

Hi Chrudimer,

Thanks for helping, it turned out I had not set the default value of the string variables on my enemy controller so it would not change the bool value of the black board key. I’ve updated these now and the AI seems to be working as intended.

I’ve noted your advice regarding the player pawn and spelling though and will bear in mind incase I run into more bugs moving forward.

How can I set this to resolved?

How can I set this to resolved?

You can mark an answer (e. g. your answer below) as accepted and you should be able to close questions (never closed a question though so no idea how you would do that).