AI Works, But Getting an Error on Game Close

I’m following an AI Scripting tutorial out of Blueprint Visual Scripting for Unreal Engine. Basically, I’m trying to get an NPC to walk to a target point, stand there for 2 to 4 seconds, then walk back to its original point, idle, again, and repeat.

When the level starts, the Event BeginPlay sets the Current Control Point to be the second, further target point, and the character walks to that point. Once he collides with its collision sphere, he waits and then the Event ActorBeginOverlap code checks for that collision, and then changes the control point to the other, previous target point.

And it works! Except every time I close it, it gives me this error:

Error Blueprint Runtime Error:
Accessed None trying to read property
CallFunc_GetBlackboard_ReturnValue
from function:
‘ExecuteUbergraph_Enemy’ from node:
Set Value as Object in graph:
EventGraph in object: Enemy with
description: Accessed None trying to
read property
CallFunc_GetBlackboard_ReturnValue

I’ve done this tutorial before without this issue, but the book is a few versions behind so does this need to be done differently to prevent this error?

I fixed this issue. The problem was that, in the map, the enemy spawns on top of the first targetpoint. Since there’s a tick before the BeginPlay event fires, thereby setting the CurrentPatrolPoint variable, when the ActorBeginOverlap event fires first and reads that variable, there’s no value assigned to it.

The solution was just to move the enemy off the target point so that it’s not colliding with it on the very first tick.