Setting AIControllerClass in Pawn constructor works and the aicontroller moves him to random location as specified in Tick function. But this works only when i drag and drop the pawn in editor. When i spawn the Pawn with SpawnActor it doesnt move.
Thats the MyAIController
Thats the pawn
When i drag and drop i see debug output that controller’s consutructor is called and then it ticks. But when i use SpawnActor i see only message from Pawn’s BeginPlay() method, when its clearly stated in constructor that AIControllerClass = AMyAIController::StaticClass();
What im doin wrong?
Okay edit2:
I made it work. I removed the AIControllerClass from pawn constructor. Instead i use SpawnActor for Pawn, SpawnActor for controller and then Possess the new pawn with new controller. Is it the fully proper way to do this?
And other question, how to properly use MoveToLocation? It seems to not move my pawn (SetActorLocation works fine tho). Do i need to create a movement component first for the pawn to use MoveToLocation function??