Directions on how to change "ESC" key from stopping play world (PIE/SIE) w/ screenshots

**Most UE4 users know that pressing escape while testing your game will exit out of the simulation of whatever you were doing. Maybe you are wanting to use escape as an inventory keybind or for your main menu. I’ve noticed that new users have asked about this in the past, well look no further for you have found this guide!

  1. Open your project, obviously.**

2. Click the “Edit” menu and choose "Editor Preferences"

3. With the “Edit” menu open, go the the “General” tab and click “Keyboard and Shortcuts”.

**4. Once you’ve clicked “Keyboard and Shortcuts”, search “Stop” in the search bar, and find “Play World (PIE/SIE)”, you can **then change the keybind to whatever you want. If it says that shortcut is already in use choose something else.

16 Likes

this does not seem to work anymore. I have tried changing this and escape still exits PIE.
EDIT: After some digging the Escape key is now hard coded into the source. if you want to disable this now you have to use a source build and edit the source.

the file is located at Engine\Source\Editor\UnrealEd\Private\Kismet2\DebuggerCommands.cpp

you want to modify the following line:


UI_COMMAND(StopPlaySession, "Stop", "Stop simulation", EUserInterfaceActionType::Button, FInputChord(EKeys::Escape));

I changed mine to:


UI_COMMAND(StopPlaySession, "Stop", "Stop simulation", EUserInterfaceActionType::Button, FInputChord(EModifierKey::Control, EKeys::Q));

and now escape no longer exits, control-Q does.
Hope this helps OP and anyone else who finds this

1 Like

The funniest thing is that I looked for this post to discover that the default shortcut to stop the game in UE5 is now Shift+Esc :rofl:

It’s nice that they finally changed it!

3 Likes

That’s funny because I had just changed it to that exact key combo before scrolling to the end of this thread.

Edit: Before I found the setting mentioned by OP and thought it was hard-coded, I found out you can bind to the FBindingContext::CommandsChanged event and override it there. You need to make sure this happens early enough, since it’ll only trigger once at editor startup. I did it in a UDeveloperSettings object so I could customize the binding, but you can probably figure out the right incantation to do it without such an object.

Sample:

#if WITH_EDITOR
void UMyDevSettingsObject::OnCommandsChanged(const FBindingContext& BindingContext)
{
	if (BindingContext.GetContextName().IsEqual("PlayWorld", ENameCase::IgnoreCase))
	{
		FPlayWorldCommands& Commands = (FPlayWorldCommands&)BindingContext;
		Commands.StopPlaySession->SetActiveChord(MyCustomOverrideBinding, EMultipleKeyBindingIndex::Primary);
	}
}
#endif

void UMyDevSettingsObject::PostInitProperties()
{
	Super::PostInitProperties();
#if WITH_EDITOR
	FBindingContext::CommandsChanged.AddUObject(this, &UMyDevSettingsObject::OnCommandsChanged);
#endif
}

Though the existing setting OP uses is probably best. :sweat_smile:

Not sure what happened in meantime, but in UE 5.5.0 works again :slight_smile: