Download

Changing controller of pawn

My ai controller works fine when it is default. I have tried using function set ai controller class to change it from default , but it did not effect anything.
21ba155bf9709759c681f9abc2d4bcc9ae1c70d3.jpeg
2.jpg

Hey,

you are changing the CLASS and you are trying to get an OBJECT of that Class.
One CLASS can be spawned SEVERAL times. Your Blueprints for example are also Classes.
And if you spawn one in your Scene, it will become one of multiple objects of that Class.

If you want to change the AI Controller class which is spawned and used, you need to open
your AI Pawn and set it in the “Class Defaults” Settings.

Also “Get AI Controller” will always return the “AIController” type as reference. If you’ve changed the
class in the DefaultSettings to your own class (which should be Child of AIController), you should
be able to cast the Return Value to your specific Controller class.

Sorry, but i did not say the controller should be chengeable in game between ai and possessed with usual controller. Is there anyway to do that?