Access Actor being controlled from AIController
I have an Actor being controlled by an AIController. I am also running a behavior tree with a blackboard. The BT is working and my A.I is moving correctly. However, I want to set up a value in the Blackboard. I want to get this value from the actor the A.I is controlling.
I can't seem to be able to access the controlled actor from the my AIController class. "Get Controlled Pawn" Returns none. Also, from my actor blueprint , "Get Controller" returns null. It's like they're not linked even though the actors are clearly following the behaviour tree of my AI Controller.
I've found a workaround for my issue, but i still have no actual solution to it. What I've done is that instead of trying to set the values in my blackboard from my actor, I'm now doing it from inside a node of my BT that I only run once.
There is a node called 'GetControlledPawn' that will give you the current Pawn controlled by a Controller. If this node does not show up, try casting your AIController to Controller.
Since you say 'getControlledPawn' and 'getController' returns None, try using Posses function to manually posses the AI Pawn and try those nodes again. See if it works then.
This may come a bit late, but I had the same question as you and I started to mess around with blueprint editor trying to figurate out a way to access to the actor blueprint being controlled by the AI controller. And finally I found a way: after you use "Get Controlled Pawn" node, you can use an action called "Get Instigator" (To be accurate it is in the following path: Variables > Actor > Get instigator ). And there you have this Pawn's Actor. Then you only have to cast it to according class and that's it.
I hope this can help you!
Follow this question
Once you sign in you will be able to subscribe for any updates here