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"

Reinstantiate Game Mode

Greetings !

I just figured out that, OpenLevel() or ServerTravel() will not recreate the game mode actor or even reset it, So I tried to use UEngine::LoadMap() which sets game mode to NULL for some reason.

Is there any way I can manually reinstantiate the game mode?

Product Version: Not Selected
more ▼

asked Dec 12 '14 at 07:33 PM in C++ Programming

avatar image

62 7 12 14

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Just use the "restartlevel" console command

more ▼

answered Dec 13 '14 at 12:22 AM

avatar image

joeGraf STAFF
1.5k 35 12 69

avatar image FrostSnake Dec 13 '14 at 08:55 AM

Didn't work for me, since it did not reset the Game mode properties to their defaults :/

avatar image joeGraf STAFF Dec 13 '14 at 05:00 PM

Are you sure? The point of that console command is to do exactly that

avatar image FrostSnake Dec 13 '14 at 06:37 PM

yes I did that, and it crashed unreal because my "Wizard" actor receives "out of index" color integer, also Game Mode beginplay is not recalled.

avatar image FrostSnake Dec 15 '14 at 07:23 PM

So, Any news about this?

avatar image joeGraf STAFF Dec 16 '14 at 07:37 PM

I just looked at the code to verify my assumptions. RestartLevel is the same thing as "open ", which means it spawns a new game mode

avatar image FrostSnake Dec 16 '14 at 07:50 PM

Oh I edited my last comment, but it seems that it didnt save....My bad.

I have figured out what you just said earlier before you post this, and figured out why the crash occurs after restarting the game.

If you can help me in this I'd be very glad :

So My game uses 2 characters, one character per player, I use the defaultly spawned character for player0 and i spawn another character (with a controller) for player1 to use. When I restart the game, I get an additional player spawned (having 3 players), I dont know why this happens :/

I even tried to destroy all actors before restarting, but didnt work, I still get 3 characters.

Ill dig more into this and see, Anyway Thanks for your help :D


Okay I figured it out, when I create a player controller using UGameplayStatistics::CreatePlayer(), the player persists when restarting level, so I had to add an additional check whether i already have player1 or should i create one.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

There currently way to change the game mode during play as stated here


But it does not mean you can't think out of the box :p technically you can make single game mode which function platform for other game modes (in diffrent class not related to GameMode), kind of like plug-ins that can be switch between. You know some multiplayer games have "objective" mode, think how to fit that in single game mode and that might bring you to proper solutions. Considering you using C++ it should be a lot easier to for you.

more ▼

answered Dec 12 '14 at 08:05 PM

avatar image

37.8k 937 172 1123

avatar image FrostSnake Dec 12 '14 at 10:20 PM

Thanks for your response, Shadowriver,

Would I be able to call that "out of the box game mode" from blueprints? (since my blueprints call the c++ game mode I created.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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