Download

How do I get controlled pawn from AIController?

The PlayerController has a GetControlledPawn() function, and it is exposed to blueprint.
The AIController, however, does not have that function. Internally in the engine source, it relies on the GetPawn() function.
However, GetPawn() is not exposed to blueprints:


	/** Getter for Pawn */
	FORCEINLINE APawn* GetPawn() const { return Pawn; }


So, how do I get the controlled/possessed pawn from inside an AIController?

(Actually, it seems as if AAIController “should” have all of the methods of AController, but yet I can’t find Get Controlled Pawn in the blueprint function popup within by AIController blueprint subclass)


class AIMODULE_API AAIController : public AController

…Aaaand now it shows up in the menu.

I opened the menu, searched, recompiled, searched again, probably five times, and it did not show up. So, thanks for being the rubber ducky eyes that makes it show up again!

Quack Quack.

Hello @jwatte Did you manage to find a solution? I need to get the controlled pawn from my controller (AIController subclass) and its not returning the pawn.

The Get Controlled Pawn node works just fine for AI controlled pawns: