x


Keyboard shortcut to pause game view play?

Is clicking the pause button at the top of the Unity editor window the only way to pause the game in game view or is there a keyboard shortcut that can be used?

more ▼

asked Jun 13, 2010 at 10:43 PM

Ben gravatar image

Ben
460 67 50 55

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

2 answers: sort voted first

Look in the Edit menu in Unity.

alt text

It should be something similar in Windows. In OS X, you can make any menu item have any keyboard shortcut you want, so if you don't like the default (or if there isn't one), feel free to change it in the system keyboard preferences.

more ▼

answered Jun 13, 2010 at 11:19 PM

Eric5h5 gravatar image

Eric5h5
112k 56 203 695

Wait, this works when the Game window has focus? That doesn't seem right... there shouldn't be any keyboard shortcuts that work while the game has focus in the editor, so as not to disrupt the game input. I disagree with this implementation. :P

Jun 14, 2010 at 12:13 AM qJake

So it appears that it does work in-game... again, I don't like that. What if someone's game used that keyboard shortcut? I don't know... I just think it would be better if it only worked if the editor itself had focus, or you had to define your own shortcut if you wanted it.

Jun 14, 2010 at 12:18 AM qJake

@SpikeX: Meh...it's more convenient to use the keyboard shortcut (I haven't actually clicked the play/pause icons in, I think, years), and how likely is it that you need the Command(ctrl)-Shift-P combo in-game? ;)

Jun 14, 2010 at 03:47 AM Eric5h5

Surprising... I still use the buttons (I suppose it's more of a tactile response than hitting a keyboard shortcut). And I haven't ever needed that shortcut in-game, but someone at some point may, it's just the principle of the matter I suppose... I would have thought that when the game had focus, the input was directed solely into the game, and nowhere else. Oh well. :P

Jun 14, 2010 at 07:03 AM qJake

Also... is that 10.4 I see? Someone needs to upgrade ;) You know they're testing 10.7 already at Apple HQ, right? ;)

Jun 14, 2010 at 07:04 AM qJake
(comments are locked)
10|3000 characters needed characters left

Update

Control+Shift+P in Windows pauses the editor (Command+Shift+P on OSX).

If you want to pause manually:

You can create your own "pause hotkey" by doing something like this:

void Update()
{
     if(Input.GetKeyDown(Keycode.P))
     {
          Debug.Break();
     }
}

This makes it so when you press "P", Unity will pause the game, exactly like hitting the "Pause" button in the editor. Alternatively, you can code your own script that uses Debug.Break(); somewhere, because whenever you call that it's just like hitting Pause in the editor.

more ▼

answered Jun 13, 2010 at 10:46 PM

qJake gravatar image

qJake
12.7k 92 140 223

Awesome. Thanks!

Jun 13, 2010 at 10:50 PM Ben

If this answer worked for you, consider upvoting (hit the grey Up arrow on this post), and accepting the answer (click the checkmark outline) so other people know this was the correct answer. Thanks!

Jun 13, 2010 at 10:57 PM qJake

Alas, it's not the correct answer...you definitely can use a keyboard shortcut for pausing in-game, just look in the Edit menu for what it is.

Jun 13, 2010 at 11:23 PM Eric5h5

Fixed my answer :P

Jun 14, 2010 at 12:37 AM qJake

Found the simple pause script very useful for testing. Thanks

Feb 25 at 03:06 PM GrayedFox
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2835
x1202
x212

asked: Jun 13, 2010 at 10:43 PM

Seen: 24353 times

Last Updated: Feb 25 at 03:06 PM