Playing Your Game From A Text Editor

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
m (Text replace - "</boo>" to "</syntaxhighlight>")
 
(3 intermediate revisions by one user not shown)
Line 1: Line 1:
 
When you're working in your text editor, it can be a nuisance to have to manually switch back to Unity to test your game.  This AppleScript will automatically bring Unity to the front and press Command-P to start the game:
 
When you're working in your text editor, it can be a nuisance to have to manually switch back to Unity to test your game.  This AppleScript will automatically bring Unity to the front and press Command-P to start the game:
  
<boo>tell application "System Events"
+
==AppleScript - Play In Unity.scpt==
 +
<syntaxhighlight lang="boo">tell application "System Events"
 
tell application "Unity" to activate
 
tell application "Unity" to activate
 
keystroke "p" using command down
 
keystroke "p" using command down
end tell</boo>
+
end tell</syntaxhighlight>
  
Enter this into the AppleScript editor, save it whatever mode your text editor supports (probably 'script'), and place it in a location where your text editor will be able to find it.
+
Enter this into the AppleScript editor, save it in whatever mode your text editor supports (probably 'script'), and place it in a location where your text editor will be able to find it.
  
 
For example, with [http://www.barebones.com/products/bbedit/ BBEdit], save the script in ~/Library/Application Support/BBEdit/Scripts/.  Once you've done that, you can assign a keystroke to launch it using the Scripts Palette.  This also works for the free [http://www.barebones.com/products/textwrangler/ TextWrangler] editor, providing you substitute 'TextWrangler' for 'BBEdit' in the above path.
 
For example, with [http://www.barebones.com/products/bbedit/ BBEdit], save the script in ~/Library/Application Support/BBEdit/Scripts/.  Once you've done that, you can assign a keystroke to launch it using the Scripts Palette.  This also works for the free [http://www.barebones.com/products/textwrangler/ TextWrangler] editor, providing you substitute 'TextWrangler' for 'BBEdit' in the above path.

Latest revision as of 20:57, 10 January 2012

When you're working in your text editor, it can be a nuisance to have to manually switch back to Unity to test your game. This AppleScript will automatically bring Unity to the front and press Command-P to start the game:

[edit] AppleScript - Play In Unity.scpt

tell application "System Events"
	tell application "Unity" to activate
	keystroke "p" using command down
end tell

Enter this into the AppleScript editor, save it in whatever mode your text editor supports (probably 'script'), and place it in a location where your text editor will be able to find it.

For example, with BBEdit, save the script in ~/Library/Application Support/BBEdit/Scripts/. Once you've done that, you can assign a keystroke to launch it using the Scripts Palette. This also works for the free TextWrangler editor, providing you substitute 'TextWrangler' for 'BBEdit' in the above path.

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox