x

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"

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!

Product Version: UE 4.7
Tags:
more ▼

asked May 14 '15 at 09:37 PM in Bug Reports

avatar image

MADHOUSE
375 22 37 58

avatar image Ben Halliday STAFF May 19 '15 at 05:39 PM

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!

avatar image MADHOUSE May 25 '15 at 12:28 AM

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.

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

1 answer: sort voted first

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.

more ▼

answered May 26 '15 at 05:31 PM

avatar image MADHOUSE Jun 10 '15 at 09:15 PM

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!

avatar image Ben Halliday STAFF Jun 10 '15 at 09:31 PM

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!

(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