Hi,
This is a weird one. I’m on 4.5.1. I just went through the Behavior Tree tutorial on the UE Documentation page. After I ran it, the AI worked perfectly. It was really cool, but then I stopped running I got a runtime error that said…
“Error Accessed None ‘CallFunc_K2_GetPawn_ReturnValue’ from node Set Blackboard Value as Object in blueprint AgroCheck”
Upon further inspection I was able to look at the controlled pawn return value and it was None. That explains the errors, but I can’t figure out why Get Controlled Pawn (on a controller) is returning None. In game, the AI runs the behavior tree just fine and the visible result in the game is the pawn coming at the player.
I’m attaching a screenshot of debugging why the Pawn == None.
I have more info. I was placing the character in the level and getting this error. As a work around, I’m spawning the character through the Spawn AI From Class node and that seems to be OK. Still not sure why the Controller can’t find it’s pawn when it’s initially placed in the level though.
I can only guess it’s a matter of timing. It’s possible to get a Controller without a ControlledPawn. Controller is an independent actor and it only gets its ControlledPawn after a Posses call. Before that it’s just a pawn-less Controller
So, this piece of blueprint you’ve attached a screenshot of, when is it called? If it’s on BeginPlay then it may be still too early. OnPosses would be a better place if you want to use data from the ControlledPawn.
Yeah, that makes more sense. The tutorial in the Documentation says to use “BeginPlay” FYI. Not sure if you have pull in getting that updated so others don’t run into that issue. Thanks for the help!
In the early staged of my game, i manually dragged the enemy pawns in the world and the “event BeginPlay” worked perfectly. A few months later I began the spawning portion of the programming and it fell apart (returned none as the topic says). I switched to “Event On Possess” and solved everything.
Thank you!
I wasted hours poking around an interconnect web of controllers, game modes, and blueprints before finally isolating the problem to this part (since it worked in the past, i just simply didn’t think the error was here).