Hi there, I’m using a 3rd party plugin with its featured player controller class and it works well, however I wanna switch it back to the normal 3rd person template player controller after certain event.
Here’s my blueprint to pass the control from current player controller to another.
As far as I know there is no way to change the controller during a level in BP.
You can set the gamemode when you change the level as additional option in the “Open Level” node which includes the controller so you could just create a few of those and switch on level transitions. Besides that there isn’t really a way, though you could just put your functionality inside of the original controller as well.
If you have to swap at any time this might be the best solution.
The “Open Level” node has the fields “Level Name” and “Options” (those are the interesting ones for us).
“Options” basically works like a URL parser for engine specific variables. There is documentation about this somewhere… but this answer has been quite a while ago and I don’t have a bookmark around.
But basically to select your gamemode you need to use something like this for your options:
“/Game/” is technically pointing into your “Content” folder. The rest is your filepath to your gamemode. Don’t forget the “_c” and yes. You repeat the name twice with a “.” in between.
For ease of use you can also do something like this to your “DefaultGame.ini”:
Which would mean instead of using the filepath you can use the short version. Which allows you to write less and only change one line if you happen to move your game mode around in your file hierarchy.