Playing Your Game From A Text Editor

From Unify Community Wiki
Revision as of 20:57, 10 January 2012 by NCarter (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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:

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