Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Reset player controller

Normally, when loading a new level the player controller is reset to default. Is there a way to reset it manually? For example, between streaming levels where the persistent level doesn't change, but you still want to reset/restart the controller to default state?

I tried destroying the controller but this seems to do nothing. Also I tried removing the player but the game crashed. Also restarting the player does nothing.

Product Version: UE 4.17
more ▼

asked Aug 22 '18 at 03:14 PM in Blueprint Scripting

avatar image

65 9 15 18

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

I found a solution:


I exposed it to BP like this:

 void UTheBirdcageCPPFunctionLibrary::SwapPlayerController(APlayerController * OldPC, APlayerController * NewPC, AGameModeBase * GameMode)
 GameMode->SwapPlayerControllers(OldPC, NewPC);

Then spawn a new player controller with the 'spawn actor from class' node and perform this function on it.

more ▼

answered Aug 23 '18 at 10:51 AM

avatar image

65 9 15 18

(comments are locked)
10|2000 characters needed characters left

I don't know if this is what you are looking for but you can set different controllers for different levels on 'world settings'.

more ▼

answered Aug 22 '18 at 09:15 PM

avatar image

125 22 26 36

avatar image bishop86 Aug 22 '18 at 10:04 PM

I actually want to use the same player controller, but a different instance of it. So when I unload the streaming level I want to destroy the current player controller and create a new one OR reset the current one to it's default state.

I managed to destroy it using C++ but this crashes the game.

avatar image mightyenigma Aug 25 '18 at 06:04 PM

there is a clunky way: GetClassDefaults function. You can copy all the values from that to the current playercontroller instance.

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question