Blueprint Runtime Error :"Accessed None trying to read property K2Node_Event_ControlledPawn"

Hello everyone!

So I am doing simple random location movement on NPCs. I am using simple code, which had no problem at all before, but suddenly it is giving me this error:

The code looks like this:

The result itself has no effect. NPC is receiving random locations, and NPC is moving, but I want to know the reason for this error, and it is enjoying closing this window down every time I end testing in the editor…

I hope someone can detect the problem…

Thanks in advance!

Hi Xvixicho,

This error is likely happening because the ‘Controlled Pawn’ is Null/Unset/Empty/Undefined.

Maybe there is a short period of time before the ‘Controlled Pawn’ gets set.

Try adding an ‘is valid’ check for the ‘Controlled Pawn’ wire, that way the execution won’t happen until the pawn variable is set.

Hope that helps!

2 Likes

Thanks, Astrotronic! That solved it! I am spawning some of these NPCs in the game, and assigning AI controllers to them on “BeginPlay” event, so I guess that was the case here.

Thanks for the fix!

1 Like