Hi everybody! I have a problem with AIController class: when I call GetPawn() function it always give me a null pointer.
This is my AMyAIController.cpp:
I believe the function that you’re looking for is GetControlledPawn which is a function of AController. AAIController inherits from AController so you’ll be able to access this function. You can find more functions of these two classes here:
Thank you! I tried your solution, but it didn’t work as well. Then I checked through the AController functions and I found GetCharacter(). Using that function resolved my problem. Thank you!
Sorry, my last comment isn’t true, I changed some things in my code, then I used GetControlledPawn() and all worked! So the right function to call is GetControlledPawn().
Thank you .