RestartLevel problem, does nothing

I am experiencing a problem with 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.
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,

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 console with ~, and typed RestartLevel. I also set an input key to ExecuteConsoleCommand “RestartLevel” in 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 command RestartLevel in output window console will work But when trying command from console in a packaged dev build, nothing happens.

When I used blueprints I would just bind a console command to one of num keys, it works great for changin maps with console commands, but not with 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: main project was started out from BP FPS Template, when testing using it, game is hosting a multiplayer session with steamworks.

Hi,

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, process is a bit more complicated. You’ll want to use OpenLevel (and feed it current level’s name) on Server, instead.

Ah I see. That explains that. Can I hope that some feature for resetting multiplayer levels will be added in future? Or will I be requiered to more or less build 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 level. For multiplayer, you’d need to do this with Server instead, using ServerTravel to same level. Depending on how you have your game working, this could mean different things for 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 simplest way to handle functionality of restarting 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 case even with RestartLevel function in a single-player game.

Hope that helps!