RestartLevel problem, does nothing

I am experiencing a problem with the console command RestartLevel, it does nothing at all. I’ve tried executing it from blueprints, from editor console, and from dev console in packaged game, nothing.
The project is a BP FPS template.

How do you reset a level since this command wont work? And why would it not work?
Thanks in advance!

Hi MADHOUSE,

I wasn’t able to reproduce any problem with Restart Level console command in 4.7.6. To test, I pushed Play and moved forward, then opened the console with ~, and typed RestartLevel. I also set an input key to ExecuteConsoleCommand “RestartLevel” in the Level Blueprint, and that worked as well. Can you show me where and how you’re setting this up with Blueprints? Does this happen with a new project as well, or only your current project? Thanks!

Hi! Thanks for helping out. Currently, now when testing this in editor, typing in the command RestartLevel in output window console will work But when trying the command from console in a packaged dev build, nothing happens.

When I used blueprints I would just bind a console command to one of the num keys, it works great for changin maps with console commands, but not with the restartlevel command.

I haven’t tried building a clean project as of yet to test this issue, I’ll get back after I’ve tried some builds.

edit: The main project was started out from the BP FPS Template, when testing using it, the game is hosting a multiplayer session with steamworks.

Hi MADHOUSE,

Ah, okay, I didn’t know you were attempting this in a multiplayer game. RestartLevel will only work in a standalone game, and not in multiplayer. For a networked game, the process is a bit more complicated. You’ll want to use OpenLevel (and feed it the current level’s name) on the Server, instead.

Ah I see. That explains that. Can I hope that some feature for resetting multiplayer levels will be added in the future? Or will I be requiered to more or less build the gamemode and all blueprints so they can be manualy reset when a match round is over? Thanks alot for your help!

Unfortunately, with multiplayer games being able to handle things very differently, a RestartLevel wouldn’t really work. But essentially, all it does is perform a ClientTravel IF in standalone (single player). What this travel does is unload and then reload everything in the level. For multiplayer, you’d need to do this with the Server instead, using ServerTravel to the same level. Depending on how you have your game working, this could mean different things for the Clients (which is why a function like RestartLevel wouldn’t really work in a networking sense).

Everything after a ServerTravel is reset (except things that are set through code to maintain values), including GameMode and all Blueprints besides GameInstance. This is probably the simplest way to handle the functionality of restarting the level. Otherwise, if things get more complex in your game and you end up carrying things over in multiple blueprints (set up through code), you’d need to manually reset values. This would be the case even with the RestartLevel function in a single-player game.

Hope that helps!